From 0de8216a258aba287366d45e12aebbaaa138d830 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Tue, 7 Jan 2025 10:45:21 -0500 Subject: [PATCH] test: update snapshots with just whitespace changes These snapshot changes should *all* only be a result of changes to trailing whitespace in the output. I checked a psuedo random sample of these, and the whitespace found in the previous snapshots seems to be an artifact of the rendering and _not_ of the source data. So this seems like a strict bug fix to me. There are other snapshots with whitespace changes, but they also have other changes that we split out into separate commits. Basically, we're going to do approximately one commit per category of change. This represents, by far, the biggest chunk of changes to snapshots as a result of the `annotate-snippets` upgrade. --- crates/ruff/tests/integration_test.rs | 6 +- ...message__text__tests__notebook_output.snap | 3 +- ...__message__text__tests__syntax_errors.snap | 5 +- ...les__airflow__tests__AIR001_AIR001.py.snap | 6 +- ...les__airflow__tests__AIR301_AIR301.py.snap | 4 +- ...airflow__tests__AIR302_AIR302_args.py.snap | 10 +- ...sts__AIR302_AIR302_class_attribute.py.snap | 19 ++- ...irflow__tests__AIR302_AIR302_names.py.snap | 127 ++++++++-------- ...les__airflow__tests__AIR303_AIR303.py.snap | 47 +++--- ...s__eradicate__tests__ERA001_ERA001.py.snap | 7 +- ..._flake8_2020__tests__YTT101_YTT101.py.snap | 5 +- ..._flake8_2020__tests__YTT102_YTT102.py.snap | 3 +- ..._flake8_2020__tests__YTT103_YTT103.py.snap | 3 +- ..._flake8_2020__tests__YTT201_YTT201.py.snap | 3 +- ..._flake8_2020__tests__YTT202_YTT202.py.snap | 3 +- ..._flake8_2020__tests__YTT203_YTT203.py.snap | 3 +- ..._flake8_2020__tests__YTT204_YTT204.py.snap | 3 +- ..._flake8_2020__tests__YTT301_YTT301.py.snap | 3 +- ..._flake8_2020__tests__YTT302_YTT302.py.snap | 3 +- ..._flake8_2020__tests__YTT303_YTT303.py.snap | 3 +- ...otations__tests__ignore_fully_untyped.snap | 3 +- ...otations__tests__simple_magic_methods.snap | 27 ++-- ...e8_async__tests__ASYNC105_ASYNC105.py.snap | 5 +- ...e8_async__tests__ASYNC115_ASYNC115.py.snap | 21 ++- ...e8_async__tests__ASYNC116_ASYNC116.py.snap | 13 +- ...e8_async__tests__ASYNC210_ASYNC210.py.snap | 17 +-- ...e8_async__tests__ASYNC220_ASYNC22x.py.snap | 5 +- ...e8_async__tests__ASYNC221_ASYNC22x.py.snap | 17 +-- ...e8_async__tests__ASYNC222_ASYNC22x.py.snap | 3 +- ...e8_async__tests__ASYNC230_ASYNC230.py.snap | 13 +- ...s__flake8_bandit__tests__S102_S102.py.snap | 6 +- ...s__flake8_bandit__tests__S103_S103.py.snap | 3 +- ...s__flake8_bandit__tests__S105_S105.py.snap | 17 +-- ...s__flake8_bandit__tests__S108_S108.py.snap | 13 +- ...es__flake8_bandit__tests__S108_extend.snap | 13 +- ...s__flake8_bandit__tests__S110_S110.py.snap | 5 +- ...les__flake8_bandit__tests__S110_typed.snap | 5 +- ...s__flake8_bandit__tests__S112_S112.py.snap | 9 +- ...s__flake8_bandit__tests__S113_S113.py.snap | 9 +- ...s__flake8_bandit__tests__S201_S201.py.snap | 3 +- ...s__flake8_bandit__tests__S301_S301.py.snap | 3 +- ...s__flake8_bandit__tests__S307_S307.py.snap | 3 +- ...s__flake8_bandit__tests__S310_S310.py.snap | 9 +- ...s__flake8_bandit__tests__S311_S311.py.snap | 3 +- ...s__flake8_bandit__tests__S312_S312.py.snap | 3 +- ...s__flake8_bandit__tests__S324_S324.py.snap | 11 +- ...s__flake8_bandit__tests__S501_S501.py.snap | 3 +- ...s__flake8_bandit__tests__S502_S502.py.snap | 5 +- ...s__flake8_bandit__tests__S504_S504.py.snap | 3 +- ...s__flake8_bandit__tests__S505_S505.py.snap | 3 +- ...s__flake8_bandit__tests__S506_S506.py.snap | 3 +- ...s__flake8_bandit__tests__S507_S507.py.snap | 3 +- ...s__flake8_bandit__tests__S508_S508.py.snap | 5 +- ...s__flake8_bandit__tests__S509_S509.py.snap | 3 +- ...s__flake8_bandit__tests__S601_S601.py.snap | 3 +- ...s__flake8_bandit__tests__S602_S602.py.snap | 5 +- ...s__flake8_bandit__tests__S603_S603.py.snap | 7 +- ...s__flake8_bandit__tests__S607_S607.py.snap | 3 +- ...s__flake8_bandit__tests__S609_S609.py.snap | 3 +- ...s__flake8_bandit__tests__S610_S610.py.snap | 13 +- ...s__flake8_bandit__tests__S612_S612.py.snap | 5 +- ...s__flake8_bandit__tests__S701_S701.py.snap | 5 +- ...s__flake8_bandit__tests__S702_S702.py.snap | 5 +- ...__flake8_bugbear__tests__B003_B003.py.snap | 3 +- ...__flake8_bugbear__tests__B004_B004.py.snap | 3 +- ...__flake8_bugbear__tests__B005_B005.py.snap | 3 +- ...flake8_bugbear__tests__B006_B006_1.py.snap | 3 +- ...flake8_bugbear__tests__B006_B006_2.py.snap | 3 +- ...flake8_bugbear__tests__B006_B006_6.py.snap | 3 +- ...flake8_bugbear__tests__B006_B006_7.py.snap | 3 +- ...ke8_bugbear__tests__B006_B006_B008.py.snap | 5 +- ...__flake8_bugbear__tests__B007_B007.py.snap | 9 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 5 +- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 3 +- ...__flake8_bugbear__tests__B012_B012.py.snap | 9 +- ...__flake8_bugbear__tests__B015_B015.py.snap | 9 +- ...__flake8_bugbear__tests__B016_B016.py.snap | 3 +- ...__flake8_bugbear__tests__B017_B017.py.snap | 5 +- ...__flake8_bugbear__tests__B019_B019.py.snap | 15 +- ...__flake8_bugbear__tests__B020_B020.py.snap | 5 +- ...__flake8_bugbear__tests__B021_B021.py.snap | 3 +- ...__flake8_bugbear__tests__B022_B022.py.snap | 5 +- ...__flake8_bugbear__tests__B023_B023.py.snap | 15 +- ...__flake8_bugbear__tests__B028_B028.py.snap | 5 +- ...__flake8_bugbear__tests__B029_B029.py.snap | 7 +- ...__flake8_bugbear__tests__B031_B031.py.snap | 21 ++- ...__flake8_bugbear__tests__B032_B032.py.snap | 11 +- ...__flake8_bugbear__tests__B033_B033.py.snap | 3 +- ...__flake8_bugbear__tests__B034_B034.py.snap | 3 +- ...__flake8_bugbear__tests__B039_B039.py.snap | 7 +- ...__flake8_bugbear__tests__B901_B901.py.snap | 5 +- ...ests__B903_class_as_data_structure.py.snap | 14 +- ...__flake8_bugbear__tests__B904_B904.py.snap | 5 +- ...rules__flake8_bugbear__tests__B905.py.snap | 5 +- ...__flake8_bugbear__tests__B909_B909.py.snap | 15 +- ...__flake8_bugbear__tests__B911_B911.py.snap | 13 +- ..._flake8_builtins__tests__A001_A001.py.snap | 27 ++-- ...sts__A001_A001.py_builtins_ignorelist.snap | 23 ++- ..._flake8_builtins__tests__A003_A003.py.snap | 5 +- ...sts__A003_A003.py_builtins_ignorelist.snap | 3 +- ..._flake8_builtins__tests__A004_A004.py.snap | 3 +- ...e8_builtins__tests__A004_A004.py_py38.snap | 3 +- ..._flake8_builtins__tests__A006_A006.py.snap | 3 +- ..._commas__tests__COM81_syntax_error.py.snap | 5 +- ...8_comprehensions__tests__C400_C400.py.snap | 4 +- ...8_comprehensions__tests__C401_C401.py.snap | 4 +- ...8_comprehensions__tests__C402_C402.py.snap | 16 +- ...8_comprehensions__tests__C403_C403.py.snap | 24 +-- ...8_comprehensions__tests__C404_C404.py.snap | 12 +- ...8_comprehensions__tests__C405_C405.py.snap | 6 +- ...8_comprehensions__tests__C408_C408.py.snap | 18 +-- ...low_dict_calls_with_keyword_arguments.snap | 8 +- ...8_comprehensions__tests__C409_C409.py.snap | 18 +-- ...8_comprehensions__tests__C410_C410.py.snap | 4 +- ...8_comprehensions__tests__C413_C413.py.snap | 4 +- ...8_comprehensions__tests__C414_C414.py.snap | 6 +- ...8_comprehensions__tests__C416_C416.py.snap | 5 +- ...8_comprehensions__tests__C417_C417.py.snap | 8 +- ...8_comprehensions__tests__C418_C418.py.snap | 2 +- ...8_comprehensions__tests__C420_C420.py.snap | 3 +- ...ensions__tests__preview__C409_C409.py.snap | 20 +-- ...e8_datetimez__tests__DTZ001_DTZ001.py.snap | 11 +- ...e8_datetimez__tests__DTZ002_DTZ002.py.snap | 5 +- ...e8_datetimez__tests__DTZ003_DTZ003.py.snap | 5 +- ...e8_datetimez__tests__DTZ004_DTZ004.py.snap | 5 +- ...e8_datetimez__tests__DTZ005_DTZ005.py.snap | 11 +- ...e8_datetimez__tests__DTZ006_DTZ006.py.snap | 11 +- ...e8_datetimez__tests__DTZ007_DTZ007.py.snap | 11 +- ...e8_datetimez__tests__DTZ011_DTZ011.py.snap | 3 +- ...e8_datetimez__tests__DTZ012_DTZ012.py.snap | 3 +- ...e8_datetimez__tests__DTZ901_DTZ901.py.snap | 9 +- ..._flake8_debugger__tests__T100_T100.py.snap | 9 +- ...flake8_executable__tests__EXE001_1.py.snap | 3 +- ...flake8_executable__tests__EXE004_4.py.snap | 4 +- ...me__tests__line-contains-fixme_T00.py.snap | 3 +- ...xme__tests__line-contains-todo_T00.py.snap | 3 +- ...icit_str_concat__tests__ISC001_ISC.py.snap | 33 ++-- ...icit_str_concat__tests__ISC002_ISC.py.snap | 7 +- ...oncat__tests__multiline_ISC001_ISC.py.snap | 33 ++-- ...ke8_import_conventions__tests__custom.snap | 9 +- ...ort_conventions__tests__custom_banned.snap | 7 +- ...onventions__tests__custom_banned_from.snap | 7 +- ...port_conventions__tests__from_imports.snap | 3 +- ...conventions__tests__override_defaults.snap | 9 +- ...t_conventions__tests__remove_defaults.snap | 9 +- ...ake8_logging__tests__LOG001_LOG001.py.snap | 3 +- ...ake8_logging__tests__LOG002_LOG002.py.snap | 5 +- ...ake8_logging__tests__LOG007_LOG007.py.snap | 3 +- ...ake8_logging__tests__LOG009_LOG009.py.snap | 5 +- ...ake8_logging__tests__LOG015_LOG015.py.snap | 5 +- ...flake8_logging_format__tests__G001.py.snap | 11 +- ...flake8_logging_format__tests__G002.py.snap | 7 +- ...flake8_logging_format__tests__G003.py.snap | 7 +- ...flake8_logging_format__tests__G004.py.snap | 11 +- ...flake8_logging_format__tests__G010.py.snap | 9 +- ...flake8_logging_format__tests__G201.py.snap | 9 +- ...flake8_logging_format__tests__G202.py.snap | 9 +- ...__flake8_pie__tests__PIE790_PIE790.py.snap | 33 ++-- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 5 +- ...__flake8_pie__tests__PIE800_PIE800.py.snap | 89 ++++++----- ...__flake8_pie__tests__PIE804_PIE804.py.snap | 29 ++-- ...__flake8_pie__tests__PIE808_PIE808.py.snap | 5 +- ...__flake8_pie__tests__PIE810_PIE810.py.snap | 7 +- ...es__flake8_print__tests__T201_T201.py.snap | 5 +- ...es__flake8_print__tests__T203_T203.py.snap | 9 +- ..._flake8_pyi__tests__PYI001_PYI001.pyi.snap | 13 +- ..._flake8_pyi__tests__PYI002_PYI002.pyi.snap | 3 +- ..._flake8_pyi__tests__PYI004_PYI004.pyi.snap | 5 +- ..._flake8_pyi__tests__PYI005_PYI005.pyi.snap | 3 +- ...__flake8_pyi__tests__PYI006_PYI006.py.snap | 23 ++- ..._flake8_pyi__tests__PYI006_PYI006.pyi.snap | 23 ++- ..._flake8_pyi__tests__PYI007_PYI007.pyi.snap | 11 +- ..._flake8_pyi__tests__PYI008_PYI008.pyi.snap | 5 +- ..._flake8_pyi__tests__PYI009_PYI009.pyi.snap | 3 +- ..._flake8_pyi__tests__PYI010_PYI010.pyi.snap | 7 +- ..._flake8_pyi__tests__PYI012_PYI012.pyi.snap | 11 +- ...__flake8_pyi__tests__PYI013_PYI013.py.snap | 5 +- ..._flake8_pyi__tests__PYI013_PYI013.pyi.snap | 13 +- ..._flake8_pyi__tests__PYI015_PYI015.pyi.snap | 3 +- ...__flake8_pyi__tests__PYI016_PYI016.py.snap | 5 +- ..._flake8_pyi__tests__PYI017_PYI017.pyi.snap | 17 +-- ...__flake8_pyi__tests__PYI018_PYI018.py.snap | 5 +- ..._flake8_pyi__tests__PYI018_PYI018.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI019_PYI019.py.snap | 49 +++--- ..._flake8_pyi__tests__PYI019_PYI019.pyi.snap | 49 +++--- ..._flake8_pyi__tests__PYI020_PYI020.pyi.snap | 13 +- ...__flake8_pyi__tests__PYI024_PYI024.py.snap | 11 +- ..._flake8_pyi__tests__PYI024_PYI024.pyi.snap | 11 +- ...flake8_pyi__tests__PYI025_PYI025_1.py.snap | 3 +- ...lake8_pyi__tests__PYI025_PYI025_1.pyi.snap | 11 +- ...flake8_pyi__tests__PYI025_PYI025_2.py.snap | 5 +- ...lake8_pyi__tests__PYI025_PYI025_2.pyi.snap | 5 +- ...flake8_pyi__tests__PYI025_PYI025_3.py.snap | 3 +- ...lake8_pyi__tests__PYI025_PYI025_3.pyi.snap | 3 +- ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 7 +- ..._flake8_pyi__tests__PYI029_PYI029.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI030_PYI030.py.snap | 41 +++-- ..._flake8_pyi__tests__PYI030_PYI030.pyi.snap | 37 +++-- ..._flake8_pyi__tests__PYI035_PYI035.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI042_PYI042.py.snap | 5 +- ..._flake8_pyi__tests__PYI042_PYI042.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI043_PYI043.py.snap | 3 +- ..._flake8_pyi__tests__PYI043_PYI043.pyi.snap | 3 +- ..._flake8_pyi__tests__PYI044_PYI044.pyi.snap | 3 +- ..._flake8_pyi__tests__PYI045_PYI045.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI047_PYI047.py.snap | 7 +- ..._flake8_pyi__tests__PYI047_PYI047.pyi.snap | 7 +- ..._flake8_pyi__tests__PYI048_PYI048.pyi.snap | 7 +- ..._flake8_pyi__tests__PYI049_PYI049.pyi.snap | 3 +- ...__flake8_pyi__tests__PYI051_PYI051.py.snap | 13 +- ..._flake8_pyi__tests__PYI051_PYI051.pyi.snap | 13 +- ..._flake8_pyi__tests__PYI053_PYI053.pyi.snap | 16 +- ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 7 +- ..._flake8_pyi__tests__PYI055_PYI055.pyi.snap | 10 +- ...__flake8_pyi__tests__PYI056_PYI056.py.snap | 3 +- ..._flake8_pyi__tests__PYI056_PYI056.pyi.snap | 3 +- ...__flake8_pyi__tests__PYI057_PYI057.py.snap | 3 +- ..._flake8_pyi__tests__PYI057_PYI057.pyi.snap | 3 +- ..._flake8_pyi__tests__PYI058_PYI058.pyi.snap | 17 +-- ...__flake8_pyi__tests__PYI059_PYI059.py.snap | 5 +- ..._flake8_pyi__tests__PYI059_PYI059.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI061_PYI061.py.snap | 11 +- ..._flake8_pyi__tests__PYI061_PYI061.pyi.snap | 5 +- ...__flake8_pyi__tests__PYI062_PYI062.py.snap | 20 +-- ..._flake8_pyi__tests__PYI062_PYI062.pyi.snap | 20 +-- ...__flake8_pyi__tests__PYI063_PYI063.py.snap | 10 +- ..._flake8_pyi__tests__PYI063_PYI063.pyi.snap | 10 +- ...__flake8_pyi__tests__PYI064_PYI064.py.snap | 9 +- ..._flake8_pyi__tests__PYI064_PYI064.pyi.snap | 9 +- ...sts__custom_classmethod_rules_preview.snap | 49 +++--- ...yi__tests__preview__PYI044_PYI044.pyi.snap | 3 +- ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 7 +- ...e8_pytest_style__tests__PT001_default.snap | 7 +- ..._pytest_style__tests__PT006_and_PT007.snap | 7 +- ...e8_pytest_style__tests__PT006_default.snap | 2 +- ...lake8_pytest_style__tests__PT006_list.snap | 2 +- ...es__flake8_pytest_style__tests__PT008.snap | 11 +- ...es__flake8_pytest_style__tests__PT009.snap | 47 +++--- ...e8_pytest_style__tests__PT011_default.snap | 9 +- ..._tests__PT011_extend_broad_exceptions.snap | 9 +- ...8_pytest_style__tests__PT011_glob_all.snap | 13 +- ...ytest_style__tests__PT011_glob_prefix.snap | 5 +- ...es__flake8_pytest_style__tests__PT013.snap | 3 +- ...es__flake8_pytest_style__tests__PT028.snap | 2 +- ...e8_pytest_style__tests__PT030_default.snap | 7 +- ..._tests__PT030_extend_broad_exceptions.snap | 7 +- ...8_pytest_style__tests__PT030_glob_all.snap | 9 +- ...ytest_style__tests__PT030_glob_prefix.snap | 3 +- ...8_pytest_style__tests__is_pytest_test.snap | 4 +- ..._tests__only_docstring_doubles_all.py.snap | 3 +- ...es__tests__only_inline_doubles_all.py.snap | 5 +- ..._tests__only_multiline_doubles_all.py.snap | 3 +- ...ubles_over_docstring_doubles_class.py.snap | 5 +- ...ocstring_doubles_module_singleline.py.snap | 3 +- ...ubles_over_docstring_singles_class.py.snap | 3 +- ...g_singles_mixed_quotes_class_var_1.py.snap | 5 +- ...g_singles_mixed_quotes_class_var_2.py.snap | 5 +- ...xed_quotes_module_singleline_var_1.py.snap | 5 +- ...xed_quotes_module_singleline_var_2.py.snap | 5 +- ...ngles_over_docstring_doubles_class.py.snap | 3 +- ...g_doubles_mixed_quotes_class_var_1.py.snap | 3 +- ...g_doubles_mixed_quotes_class_var_2.py.snap | 3 +- ...xed_quotes_module_singleline_var_1.py.snap | 3 +- ...xed_quotes_module_singleline_var_2.py.snap | 3 +- ...ngles_over_docstring_singles_class.py.snap | 5 +- ...ocstring_singles_module_singleline.py.snap | 3 +- ...quire_doubles_over_singles_escaped.py.snap | 5 +- ...s_over_singles_escaped_unnecessary.py.snap | 11 +- ...bles_over_singles_multiline_string.py.snap | 3 +- ...quire_singles_over_doubles_escaped.py.snap | 5 +- ...s_over_doubles_escaped_unnecessary.py.snap | 9 +- ...gles_over_doubles_multiline_string.py.snap | 3 +- ...ry-paren-on-raise-exception_RSE102.py.snap | 35 +++-- ...lake8_return__tests__RET501_RET501.py.snap | 3 +- ...lake8_return__tests__RET505_RET505.py.snap | 3 +- ...ests__private-member-access_SLF001.py.snap | 5 +- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 17 +-- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 27 ++-- ...ke8_simplify__tests__SIM115_SIM115.py.snap | 7 +- ...ke8_simplify__tests__SIM116_SIM116.py.snap | 15 +- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 61 ++++---- ...ke8_simplify__tests__SIM208_SIM208.py.snap | 13 +- ...ke8_simplify__tests__SIM210_SIM210.py.snap | 13 +- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 11 +- ...ke8_simplify__tests__SIM212_SIM212.py.snap | 7 +- ...ke8_simplify__tests__SIM220_SIM220.py.snap | 5 +- ...ke8_simplify__tests__SIM221_SIM221.py.snap | 5 +- ...ke8_simplify__tests__SIM222_SIM222.py.snap | 137 +++++++++-------- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 137 +++++++++-------- ...ke8_simplify__tests__SIM300_SIM300.py.snap | 5 +- ...ke8_simplify__tests__SIM905_SIM905.py.snap | 17 +-- ...ke8_simplify__tests__SIM910_SIM910.py.snap | 15 +- ...ify__tests__preview__SIM108_SIM108.py.snap | 20 ++- ...ake8_slots__tests__SLOT001_SLOT001.py.snap | 3 +- ...ts__tests__ban_parent_imports_package.snap | 3 +- ...lake8_tidy_imports__tests__banned_api.snap | 39 +++-- ...dy_imports__tests__banned_api_package.snap | 5 +- ...s__tests__banned_module_level_imports.snap | 27 ++-- ...os__tests__missing-todo-link_TD003.py.snap | 11 +- ...s__empty-type-checking-block_TC005.py.snap | 5 +- ..._type_checking__tests__exempt_modules.snap | 3 +- ...sts__multiple_modules_different_types.snap | 9 +- ...ng__tests__multiple_modules_same_type.snap | 9 +- ...ype_checking__tests__no_typing_import.snap | 5 +- ...mport-in-type-checking-block_quote.py.snap | 4 +- ...ping-only-third-party-import_quote.py.snap | 29 ++-- ...ing-only-third-party-import_quote2.py.snap | 31 ++-- ...ng__tests__quoted-type-alias_TC008.py.snap | 8 +- ...ias_TC008_typing_execution_context.py.snap | 2 +- ...rt-in-type-checking-block_TC004_11.py.snap | 3 +- ...rt-in-type-checking-block_TC004_12.py.snap | 3 +- ...ort-in-type-checking-block_TC004_9.py.snap | 5 +- ...in-type-checking-block_module__app.py.snap | 2 +- ...mport-in-type-checking-block_quote.py.snap | 4 +- ...k_runtime_evaluated_base_classes_1.py.snap | 5 +- ...ock_runtime_evaluated_decorators_1.py.snap | 5 +- ...ests__runtime-string-union_TC010_1.py.snap | 3 +- ...ests__runtime-string-union_TC010_2.py.snap | 5 +- ...y-standard-library-import_init_var.py.snap | 3 +- ...ly-standard-library-import_kw_only.py.snap | 3 +- ...ing-only-third-party-import_strict.py.snap | 9 +- ...g__tests__tc004_precedence_over_tc007.snap | 2 +- ...g__tests__tc010_precedence_over_tc008.snap | 2 +- ...ests__type_checking_block_after_usage.snap | 5 +- ...g__tests__type_checking_block_comment.snap | 5 +- ...ng__tests__type_checking_block_inline.snap | 5 +- ...__tests__type_checking_block_own_line.snap | 5 +- ...ping-only-first-party-import_TC001.py.snap | 3 +- ...only-standard-library-import_TC003.py.snap | 3 +- ...rary-import_exempt_type_checking_1.py.snap | 5 +- ...rary-import_exempt_type_checking_2.py.snap | 5 +- ...rary-import_exempt_type_checking_3.py.snap | 5 +- ...d-library-import_module__undefined.py.snap | 3 +- ...t_runtime_evaluated_base_classes_3.py.snap | 3 +- ...ping-only-third-party-import_TC002.py.snap | 21 ++- ...t_runtime_evaluated_base_classes_2.py.snap | 3 +- ...ort_runtime_evaluated_decorators_2.py.snap | 3 +- ...-third-party-import_singledispatch.py.snap | 3 +- ...ing-only-third-party-import_strict.py.snap | 3 +- ...hird-party-import_typing_modules_1.py.snap | 3 +- ...hird-party-import_typing_modules_2.py.snap | 3 +- ...s__typing_import_after_package_import.snap | 5 +- ...ing__tests__typing_import_after_usage.snap | 5 +- ...__typing_import_before_package_import.snap | 5 +- ...__tests__unquoted-type-alias_TC007.py.snap | 2 +- ...nused_arguments__tests__ARG002_ARG.py.snap | 11 +- ...nused_arguments__tests__ARG005_ARG.py.snap | 3 +- ...uments__tests__enforce_variadic_names.snap | 9 +- ...guments__tests__ignore_variadic_names.snap | 5 +- ...e_pathlib__tests__PTH124_py_path_1.py.snap | 3 +- ...e_pathlib__tests__PTH124_py_path_2.py.snap | 3 +- ..._use_pathlib__tests__PTH202_PTH202.py.snap | 5 +- ..._use_pathlib__tests__PTH203_PTH203.py.snap | 3 +- ..._use_pathlib__tests__PTH205_PTH205.py.snap | 5 +- ..._use_pathlib__tests__PTH206_PTH206.py.snap | 3 +- ..._use_pathlib__tests__PTH208_PTH208.py.snap | 9 +- ..._use_pathlib__tests__PTH210_PTH210.py.snap | 21 ++- ...se_pathlib__tests__PTH210_PTH210_1.py.snap | 13 +- ...ake8_use_pathlib__tests__full_name.py.snap | 5 +- ...ake8_use_pathlib__tests__import_as.py.snap | 3 +- ...e8_use_pathlib__tests__import_from.py.snap | 4 +- ...use_pathlib__tests__import_from_as.py.snap | 3 +- ...rules__flynt__tests__FLY002_FLY002.py.snap | 3 +- ...ules__isort__tests__leading_prefix.py.snap | 7 +- ...ort__tests__required_import_unused.py.snap | 5 +- ...ules__mccabe__tests__max_complexity_0.snap | 9 +- ...__numpy-deprecated-function_NPY003.py.snap | 5 +- ...numpy-deprecated-type-alias_NPY001.py.snap | 19 ++- ..._tests__numpy-legacy-random_NPY002.py.snap | 5 +- ...__tests__numpy2-deprecation_NPY201.py.snap | 141 +++++++++--------- ...tests__numpy2-deprecation_NPY201_2.py.snap | 111 +++++++------- ...tests__numpy2-deprecation_NPY201_3.py.snap | 27 ++-- ...es__pandas_vet__tests__PD002_PD002.py.snap | 23 ++- ...PD012_pandas_use_of_dot_read_table.py.snap | 3 +- ...es__pandas_vet__tests__PD101_PD101.py.snap | 3 +- ...les__pep8_naming__tests__N802_N802.py.snap | 3 +- ...les__pep8_naming__tests__N804_N804.py.snap | 13 +- ...les__pep8_naming__tests__N805_N805.py.snap | 13 +- ...les__pep8_naming__tests__N806_N806.py.snap | 7 +- ...les__pep8_naming__tests__N811_N811.py.snap | 2 +- ...les__pep8_naming__tests__N814_N814.py.snap | 2 +- ...case_imported_as_incorrect_convention.snap | 3 +- ...naming__tests__classmethod_decorators.snap | 13 +- ...ing__tests__ignore_names_N801_N801.py.snap | 5 +- ...ing__tests__ignore_names_N802_N802.py.snap | 5 +- ...ing__tests__ignore_names_N803_N803.py.snap | 5 +- ...ing__tests__ignore_names_N804_N804.py.snap | 3 +- ...ing__tests__ignore_names_N805_N805.py.snap | 9 +- ...ing__tests__ignore_names_N806_N806.py.snap | 3 +- ...ing__tests__ignore_names_N807_N807.py.snap | 5 +- ...ing__tests__ignore_names_N811_N811.py.snap | 3 +- ...ing__tests__ignore_names_N812_N812.py.snap | 3 +- ...ing__tests__ignore_names_N813_N813.py.snap | 5 +- ...ing__tests__ignore_names_N814_N814.py.snap | 5 +- ...ing__tests__ignore_names_N815_N815.py.snap | 11 +- ...ing__tests__ignore_names_N816_N816.py.snap | 5 +- ...ing__tests__ignore_names_N817_N817.py.snap | 3 +- ...ing__tests__ignore_names_N818_N818.py.snap | 5 +- ...aming__tests__staticmethod_decorators.snap | 13 +- ...__perflint__tests__PERF101_PERF101.py.snap | 23 ++- ...les__pycodestyle__tests__E101_E101.py.snap | 5 +- ...ules__pycodestyle__tests__E201_E20.py.snap | 5 +- ...ules__pycodestyle__tests__E202_E20.py.snap | 3 +- ...ules__pycodestyle__tests__E203_E20.py.snap | 17 +-- ...ules__pycodestyle__tests__E221_E22.py.snap | 3 +- ...ules__pycodestyle__tests__E222_E22.py.snap | 3 +- ...ules__pycodestyle__tests__E252_E25.py.snap | 21 ++- ...ules__pycodestyle__tests__E262_E26.py.snap | 9 +- ...ules__pycodestyle__tests__E265_E26.py.snap | 7 +- ...ules__pycodestyle__tests__E266_E26.py.snap | 7 +- ...ules__pycodestyle__tests__E271_E27.py.snap | 3 +- ...ules__pycodestyle__tests__E273_E27.py.snap | 3 +- ...tyle__tests__E301_E30_syntax_error.py.snap | 9 +- ...ules__pycodestyle__tests__E302_E30.py.snap | 11 +- ...ts__E302_E302_first_line_docstring.py.snap | 3 +- ...s__E302_E302_first_line_expression.py.snap | 3 +- ...sts__E302_E302_first_line_function.py.snap | 3 +- ...ts__E302_E302_first_line_statement.py.snap | 3 +- ...tyle__tests__E302_E30_syntax_error.py.snap | 11 +- ...ules__pycodestyle__tests__E303_E30.py.snap | 9 +- ...tyle__tests__E303_E30_syntax_error.py.snap | 9 +- ...ules__pycodestyle__tests__E304_E30.py.snap | 3 +- ...ules__pycodestyle__tests__E305_E30.py.snap | 5 +- ...tyle__tests__E305_E30_syntax_error.py.snap | 11 +- ...tyle__tests__E306_E30_syntax_error.py.snap | 9 +- ...ules__pycodestyle__tests__E401_E40.py.snap | 17 +-- ...ules__pycodestyle__tests__E402_E40.py.snap | 13 +- ...__pycodestyle__tests__E402_E402.ipynb.snap | 9 +- ...s__pycodestyle__tests__E402_E402_0.py.snap | 7 +- ...s__pycodestyle__tests__E402_E402_1.py.snap | 7 +- ...les__pycodestyle__tests__E711_E711.py.snap | 5 +- ...les__pycodestyle__tests__E712_E712.py.snap | 9 +- ...les__pycodestyle__tests__E721_E721.py.snap | 5 +- ...les__pycodestyle__tests__E741_E741.py.snap | 17 +-- ...les__pycodestyle__tests__W291_W291.py.snap | 3 +- ...s__pycodestyle__tests__W605_W605_0.py.snap | 13 +- ...s__pycodestyle__tests__W605_W605_1.py.snap | 10 +- ...yle__tests__blank_lines_E302_notebook.snap | 3 +- ...yle__tests__blank_lines_E303_notebook.snap | 3 +- ...yle__tests__blank_lines_E304_notebook.snap | 3 +- ...s__pycodestyle__tests__max_doc_length.snap | 13 +- ...yle__tests__max_doc_length_with_utf_8.snap | 13 +- ...destyle__tests__preview__E502_E502.py.snap | 5 +- ...style__tests__preview__W391_W391_0.py.snap | 3 +- ...rules__pycodestyle__tests__tab_size_1.snap | 3 +- ...rules__pycodestyle__tests__tab_size_2.snap | 3 +- ...rules__pycodestyle__tests__tab_size_4.snap | 3 +- ...rules__pycodestyle__tests__tab_size_8.snap | 3 +- ...__rules__pydocstyle__tests__D101_D.py.snap | 3 +- ...__rules__pydocstyle__tests__D107_D.py.snap | 3 +- ...ules__pydocstyle__tests__D202_D202.py.snap | 3 +- ...__rules__pydocstyle__tests__D204_D.py.snap | 3 +- ...__rules__pydocstyle__tests__D211_D.py.snap | 5 +- ...ydocstyle__tests__D214_D214_module.py.snap | 5 +- ...__pydocstyle__tests__D214_sections.py.snap | 5 +- ...ules__pydocstyle__tests__D402_D402.py.snap | 3 +- ...__rules__pydocstyle__tests__D404_D.py.snap | 5 +- ...__pydocstyle__tests__D405_sections.py.snap | 6 +- ...__pydocstyle__tests__D406_sections.py.snap | 4 +- ...__pydocstyle__tests__D407_sections.py.snap | 10 +- ...__pydocstyle__tests__D408_sections.py.snap | 3 +- ...ules__pydocstyle__tests__D410_D410.py.snap | 5 +- ...__pydocstyle__tests__D410_sections.py.snap | 5 +- ...__pydocstyle__tests__D412_sections.py.snap | 3 +- ...ules__pydocstyle__tests__D413_D413.py.snap | 9 +- ...__pydocstyle__tests__D413_sections.py.snap | 18 +-- ...__pydocstyle__tests__D414_sections.py.snap | 17 +-- ...__pydocstyle__tests__D417_sections.py.snap | 3 +- ...__rules__pydocstyle__tests__D419_D.py.snap | 3 +- ...rules__pydocstyle__tests__d417_google.snap | 3 +- ...__pydocstyle__tests__d417_unspecified.snap | 3 +- ...417_unspecified_ignore_var_parameters.snap | 3 +- ...ules__pyflakes__tests__F401_F401_0.py.snap | 15 +- ...les__pyflakes__tests__F401_F401_10.py.snap | 5 +- ...les__pyflakes__tests__F401_F401_17.py.snap | 5 +- ...ules__pyflakes__tests__F401_F401_6.py.snap | 7 +- ...F401_29__all_conditional____init__.py.snap | 9 +- ...ts__F401_deprecated_option_F401_30.py.snap | 3 +- ...F401_29__all_conditional____init__.py.snap | 9 +- ..._rules__pyflakes__tests__F402_F402.py.snap | 3 +- ..._rules__pyflakes__tests__F403_F403.py.snap | 3 +- ...ules__pyflakes__tests__F404_F404_0.py.snap | 5 +- ...ules__pyflakes__tests__F404_F404_1.py.snap | 3 +- ..._rules__pyflakes__tests__F405_F405.py.snap | 3 +- ..._rules__pyflakes__tests__F504_F504.py.snap | 11 +- ..._rules__pyflakes__tests__F506_F50x.py.snap | 3 +- ..._rules__pyflakes__tests__F508_F50x.py.snap | 3 +- ..._rules__pyflakes__tests__F521_F521.py.snap | 3 +- ..._rules__pyflakes__tests__F523_F523.py.snap | 12 +- ..._rules__pyflakes__tests__F541_F541.py.snap | 5 +- ..._rules__pyflakes__tests__F601_F601.py.snap | 11 +- ..._rules__pyflakes__tests__F602_F602.py.snap | 3 +- ..._rules__pyflakes__tests__F632_F632.py.snap | 21 ++- ..._rules__pyflakes__tests__F633_F633.py.snap | 3 +- ..._rules__pyflakes__tests__F634_F634.py.snap | 3 +- ..._rules__pyflakes__tests__F701_F701.py.snap | 5 +- ..._rules__pyflakes__tests__F702_F702.py.snap | 5 +- ...les__pyflakes__tests__F811_F811_17.py.snap | 3 +- ...les__pyflakes__tests__F811_F811_26.py.snap | 3 +- ...les__pyflakes__tests__F811_F811_28.py.snap | 3 +- ...es__pyflakes__tests__F811_F811_29.pyi.snap | 3 +- ...les__pyflakes__tests__F811_F811_30.py.snap | 7 +- ...les__pyflakes__tests__F811_F811_31.py.snap | 3 +- ...ules__pyflakes__tests__F821_F821_0.py.snap | 7 +- ...les__pyflakes__tests__F821_F821_13.py.snap | 3 +- ...ules__pyflakes__tests__F821_F821_2.py.snap | 3 +- ...les__pyflakes__tests__F821_F821_20.py.snap | 5 +- ...les__pyflakes__tests__F821_F821_28.py.snap | 3 +- ...ules__pyflakes__tests__F821_F821_3.py.snap | 5 +- ...ules__pyflakes__tests__F821_F821_4.py.snap | 11 +- ...ules__pyflakes__tests__F822_F822_0.py.snap | 3 +- ...les__pyflakes__tests__F822_F822_0.pyi.snap | 3 +- ...ules__pyflakes__tests__F822_F822_1.py.snap | 3 +- ...les__pyflakes__tests__F822_F822_1b.py.snap | 3 +- ..._rules__pyflakes__tests__F823_F823.py.snap | 5 +- ...ules__pyflakes__tests__F841_F841_0.py.snap | 11 +- ...ules__pyflakes__tests__F841_F841_3.py.snap | 19 ++- ...hadowed_global_import_in_global_scope.snap | 3 +- ...shadowed_global_import_in_local_scope.snap | 5 +- ...shadowed_import_shadow_in_local_scope.snap | 3 +- ..._shadowed_local_import_in_local_scope.snap | 3 +- ...lakes__tests__f841_dummy_variable_rgx.snap | 11 +- ..._linter__rules__pyflakes__tests__init.snap | 3 +- ...yflakes__tests__multi_statement_lines.snap | 15 +- ...F401_29__all_conditional____init__.py.snap | 9 +- ...kes__tests__preview__F401___init__.py.snap | 3 +- ...kes__tests__preview__F822___init__.py.snap | 7 +- ...grep_hooks__tests__PGH003_PGH003_0.py.snap | 3 +- ...grep_hooks__tests__PGH003_PGH003_1.py.snap | 3 +- ...grep_hooks__tests__PGH004_PGH004_0.py.snap | 9 +- ...grep_hooks__tests__PGH005_PGH005_0.py.snap | 3 +- ...C0105_type_name_incorrect_variance.py.snap | 13 +- ...nt__tests__PLC0131_type_bivariance.py.snap | 9 +- ...__PLC0132_type_param_name_mismatch.py.snap | 17 +-- ...tests__PLC0205_single_string_slots.py.snap | 7 +- ...__PLC0206_dict_index_missing_items.py.snap | 23 ++- ..._tests__PLC0208_iteration_over_set.py.snap | 25 ++-- ...nt__tests__PLC0414_import_aliasing.py.snap | 3 +- ...__PLC0415_import_outside_top_level.py.snap | 3 +- ...t__tests__PLC1802_len_as_condition.py.snap | 25 ++-- ...s__PLC1901_compare_to_empty_string.py.snap | 7 +- ...int__tests__PLC2401_non_ascii_name.py.snap | 9 +- ...s__PLC2403_non_ascii_module_import.py.snap | 7 +- ..._private_name__submodule____main__.py.snap | 3 +- ...s__PLC2801_unnecessary_dunder_call.py.snap | 24 +-- ...002_unnecessary_direct_lambda_call.py.snap | 3 +- ...lint__tests__PLE0100_yield_in_init.py.snap | 3 +- ...int__tests__PLE0101_return_in_init.py.snap | 5 +- ...118_load_before_global_declaration.py.snap | 37 +++-- ...nexpected_special_method_signature.py.snap | 15 +- ...__PLE0304_invalid_return_type_bool.py.snap | 3 +- ..._tests__PLE0604_invalid_all_object.py.snap | 3 +- ..._tests__PLE0605_invalid_all_format.py.snap | 51 ++++--- ...sts__PLE0643_potential_index_error.py.snap | 3 +- ...ests__PLE0704_misplaced_bare_raise.py.snap | 13 +- ...s__PLE1141_dict_iter_missing_items.py.snap | 3 +- ...sts__PLE1205_logging_too_many_args.py.snap | 17 +-- ...ests__PLE1206_logging_too_few_args.py.snap | 9 +- ...LE1300_bad_string_format_character.py.snap | 21 ++- ...ts__PLE1307_bad_string_format_type.py.snap | 11 +- ...ests__PLE1507_invalid_envvar_value.py.snap | 5 +- ...sts__PLE1519_singledispatch_method.py.snap | 5 +- ..._tests__PLE2510_invalid_characters.py.snap | 7 +- ..._tests__PLE2513_invalid_characters.py.snap | 9 +- ...ts__PLE4703_modified_iterating_set.py.snap | 13 +- ...ts__PLR0124_comparison_with_itself.py.snap | 47 +++--- ...ts__PLR0133_comparison_of_constant.py.snap | 19 ++- ...__tests__PLR0912_too_many_branches.py.snap | 3 +- ...0917_too_many_positional_arguments.py.snap | 3 +- ...R1714_repeated_equality_comparison.py.snap | 84 +++++------ ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 5 +- ...__tests__PLR1722_sys_exit_alias_11.py.snap | 3 +- ...__tests__PLR1722_sys_exit_alias_12.py.snap | 3 +- ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 3 +- ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 3 +- ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 3 +- ...1733_unnecessary_dict_index_lookup.py.snap | 3 +- ...1736_unnecessary_list_index_lookup.py.snap | 7 +- ...ts__PLR2004_magic_value_comparison.py.snap | 17 +-- ...lint__tests__PLR2044_empty_comment.py.snap | 7 +- ...__PLR6104_non_augmented_assignment.py.snap | 35 +++-- ..._tests__PLR6201_literal_membership.py.snap | 3 +- ...pylint__tests__PLR6301_no_self_use.py.snap | 5 +- ..._tests__PLW0108_unnecessary_lambda.py.snap | 11 +- ...ests__PLW0120_useless_else_on_loop.py.snap | 3 +- ...s__PLW0127_self_assigning_variable.py.snap | 5 +- ...__PLW0128_redeclared_assigned_name.py.snap | 5 +- ...__PLW0129_assert_on_string_literal.py.snap | 3 +- ...LW0133_useless_exception_statement.py.snap | 9 +- ...W0602_global_variable_not_assigned.py.snap | 3 +- ...t__tests__PLW0603_global_statement.py.snap | 7 +- ...ts__PLW0604_global_at_module_level.py.snap | 5 +- ...ts__PLW0642_self_or_cls_assignment.py.snap | 9 +- ...lint__tests__PLW1501_bad_open_mode.py.snap | 3 +- ...ests__PLW1507_shallow_copy_environ.py.snap | 3 +- ...ts__PLW1508_invalid_envvar_default.py.snap | 3 +- ...LW1509_subprocess_popen_preexec_fn.py.snap | 3 +- ...W1510_subprocess_run_without_check.py.snap | 3 +- ...ests__PLW1514_unspecified_encoding.py.snap | 9 +- ...nt__tests__PLW1641_eq_without_hash.py.snap | 3 +- ...__tests__PLW2101_useless_with_lock.py.snap | 21 ++- ...tests__PLW2901_redefined_loop_name.py.snap | 9 +- ...ts__PLW3201_bad_dunder_method_name.py.snap | 11 +- ...int__tests__PLW3301_nested_min_max.py.snap | 13 +- ...ylint__tests__allow_magic_value_types.snap | 11 +- ...s__pylint__tests__continue_in_finally.snap | 15 +- ...r__rules__pylint__tests__max_branches.snap | 3 +- ...R1714_repeated_equality_comparison.py.snap | 84 +++++------ ...ew__PLW1508_invalid_envvar_default.py.snap | 3 +- ...ylint__tests__too_many_public_methods.snap | 22 +-- ...er__rules__pyupgrade__tests__UP001.py.snap | 3 +- ...er__rules__pyupgrade__tests__UP003.py.snap | 3 +- ...er__rules__pyupgrade__tests__UP004.py.snap | 3 +- ...__rules__pyupgrade__tests__UP009_0.py.snap | 3 +- ...__rules__pyupgrade__tests__UP009_1.py.snap | 3 +- ...er__rules__pyupgrade__tests__UP010.py.snap | 5 +- ...er__rules__pyupgrade__tests__UP013.py.snap | 22 +-- ...er__rules__pyupgrade__tests__UP014.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP015.py.snap | 39 +++-- ...er__rules__pyupgrade__tests__UP018.py.snap | 5 +- ...er__rules__pyupgrade__tests__UP020.py.snap | 5 +- ...er__rules__pyupgrade__tests__UP021.py.snap | 3 +- ...er__rules__pyupgrade__tests__UP022.py.snap | 39 +++-- ...er__rules__pyupgrade__tests__UP023.py.snap | 17 +-- ...__rules__pyupgrade__tests__UP024_2.py.snap | 25 ++-- ...er__rules__pyupgrade__tests__UP025.py.snap | 39 +++-- ...__rules__pyupgrade__tests__UP032_2.py.snap | 21 ++- ...er__rules__pyupgrade__tests__UP034.py.snap | 18 +-- ...__rules__pyupgrade__tests__UP036_0.py.snap | 71 +++++---- ...__rules__pyupgrade__tests__UP036_1.py.snap | 15 +- ...__rules__pyupgrade__tests__UP036_2.py.snap | 23 ++- ...__rules__pyupgrade__tests__UP036_3.py.snap | 3 +- ...__rules__pyupgrade__tests__UP036_4.py.snap | 7 +- ...__rules__pyupgrade__tests__UP036_5.py.snap | 7 +- ...__rules__pyupgrade__tests__UP037_0.py.snap | 71 +++++---- ..._rules__pyupgrade__tests__UP037_2.pyi.snap | 3 +- ...er__rules__pyupgrade__tests__UP038.py.snap | 3 +- ...er__rules__pyupgrade__tests__UP040.py.snap | 29 ++-- ...rade__tests__datetime_utc_alias_py311.snap | 9 +- ..._annotations_keep_runtime_typing_p310.snap | 5 +- ...sts__future_annotations_pep_585_py310.snap | 5 +- ...tests__future_annotations_pep_604_p37.snap | 3 +- ...sts__future_annotations_pep_604_py310.snap | 5 +- ...es__refurb__tests__FURB105_FURB105.py.snap | 5 +- ...es__refurb__tests__FURB116_FURB116.py.snap | 13 +- ...es__refurb__tests__FURB118_FURB118.py.snap | 12 +- ...es__refurb__tests__FURB129_FURB129.py.snap | 7 +- ...es__refurb__tests__FURB131_FURB131.py.snap | 5 +- ...es__refurb__tests__FURB136_FURB136.py.snap | 35 +++-- ...es__refurb__tests__FURB140_FURB140.py.snap | 13 +- ...es__refurb__tests__FURB142_FURB142.py.snap | 37 +++-- ...es__refurb__tests__FURB145_FURB145.py.snap | 3 +- ...es__refurb__tests__FURB148_FURB148.py.snap | 47 +++--- ...es__refurb__tests__FURB152_FURB152.py.snap | 59 ++++---- ...es__refurb__tests__FURB157_FURB157.py.snap | 4 +- ...es__refurb__tests__FURB161_FURB161.py.snap | 5 +- ...es__refurb__tests__FURB163_FURB163.py.snap | 3 +- ...es__refurb__tests__FURB164_FURB164.py.snap | 3 +- ...es__refurb__tests__FURB166_FURB166.py.snap | 15 +- ...es__refurb__tests__FURB168_FURB168.py.snap | 15 +- ...es__refurb__tests__FURB169_FURB169.py.snap | 49 +++--- ...es__refurb__tests__FURB171_FURB171.py.snap | 13 +- ...es__refurb__tests__FURB177_FURB177.py.snap | 19 ++- ...es__refurb__tests__FURB180_FURB180.py.snap | 3 +- ...es__refurb__tests__FURB181_FURB181.py.snap | 16 +- ...es__refurb__tests__FURB189_FURB189.py.snap | 5 +- ...es__refurb__tests__FURB192_FURB192.py.snap | 37 +++-- ..._rules__ruff__tests__RUF005_RUF005.py.snap | 25 ++-- ..._rules__ruff__tests__RUF006_RUF006.py.snap | 5 +- ..._rules__ruff__tests__RUF010_RUF010.py.snap | 39 +++-- ..._rules__ruff__tests__RUF012_RUF012.py.snap | 6 +- ..._rules__ruff__tests__RUF015_RUF015.py.snap | 15 +- ..._rules__ruff__tests__RUF016_RUF016.py.snap | 41 +++-- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 5 +- ..._rules__ruff__tests__RUF019_RUF019.py.snap | 13 +- ..._rules__ruff__tests__RUF020_RUF020.py.snap | 6 +- ..._rules__ruff__tests__RUF021_RUF021.py.snap | 11 +- ..._rules__ruff__tests__RUF023_RUF023.py.snap | 56 +++---- ..._rules__ruff__tests__RUF024_RUF024.py.snap | 3 +- ...ules__ruff__tests__RUF027_RUF027_0.py.snap | 5 +- ..._rules__ruff__tests__RUF030_RUF030.py.snap | 36 ++--- ..._rules__ruff__tests__RUF031_RUF031.py.snap | 3 +- ..._rules__ruff__tests__RUF032_RUF032.py.snap | 43 +++--- ..._rules__ruff__tests__RUF033_RUF033.py.snap | 13 +- ..._rules__ruff__tests__RUF034_RUF034.py.snap | 5 +- ...rules__ruff__tests__RUF036_RUF036.pyi.snap | 31 ++-- ...rules__ruff__tests__RUF038_RUF038.pyi.snap | 22 +-- ..._rules__ruff__tests__RUF040_RUF040.py.snap | 3 +- ..._rules__ruff__tests__RUF041_RUF041.py.snap | 7 +- ...rules__ruff__tests__RUF041_RUF041.pyi.snap | 6 +- ..._rules__ruff__tests__RUF052_RUF052.py.snap | 5 +- ..._rules__ruff__tests__RUF056_RUF056.py.snap | 13 +- ...ules__ruff__tests__RUF101_RUF101_1.py.snap | 3 +- ...nter__rules__ruff__tests__confusables.snap | 19 ++- ...var_regexp_preset__RUF052_RUF052.py_1.snap | 5 +- ...var_regexp_preset__RUF052_RUF052.py_2.snap | 4 +- ...uff__tests__preview__RUF039_RUF039.py.snap | 8 +- ...uff__tests__preview__RUF043_RUF043.py.snap | 20 +-- ...uff__tests__preview__RUF046_RUF046.py.snap | 92 ++++++------ ...uff__tests__preview__RUF048_RUF048.py.snap | 2 +- ...f__tests__preview__RUF048_RUF048_1.py.snap | 4 +- ...uff__tests__preview__RUF049_RUF049.py.snap | 3 +- ...f__tests__preview__RUF055_RUF055_0.py.snap | 9 +- ...f__tests__preview__RUF055_RUF055_1.py.snap | 4 +- ...les__ruff__tests__preview_confusables.snap | 21 ++- ..._linter__rules__ruff__tests__ruf100_0.snap | 33 ++-- ...__rules__ruff__tests__ruf100_0_prefix.snap | 31 ++-- ..._linter__rules__ruff__tests__ruf100_3.snap | 9 +- ..._linter__rules__ruff__tests__ruf100_5.snap | 7 +- ..._error-instead-of-exception_TRY400.py.snap | 11 +- ..._tests__raise-vanilla-class_TRY002.py.snap | 5 +- ...ps__tests__raise-within-try_TRY301.py.snap | 13 +- ..._tests__verbose-log-message_TRY401.py.snap | 5 +- ...er__linter__tests__ipy_escape_command.snap | 5 +- ...er__linter__tests__vscode_language_id.snap | 3 +- ...essions__arguments__double_starred.py.snap | 7 +- ...ons__arguments__invalid_expression.py.snap | 5 +- ...ons__arguments__missing_expression.py.snap | 3 +- ...expressions__arguments__unclosed_0.py.snap | 3 +- ...expressions__arguments__unclosed_1.py.snap | 3 +- ...expressions__arguments__unclosed_2.py.snap | 3 +- ...xpressions__await__no_expression_0.py.snap | 3 +- ...xpressions__await__no_expression_1.py.snap | 3 +- ...syntax@expressions__await__recover.py.snap | 5 +- ...ns__bin_op__invalid_rhs_expression.py.snap | 5 +- ...x@expressions__bin_op__missing_lhs.py.snap | 3 +- ...expressions__bin_op__missing_rhs_0.py.snap | 3 +- ...expressions__bin_op__missing_rhs_1.py.snap | 3 +- ...s__bool_op__invalid_rhs_expression.py.snap | 5 +- ...@expressions__bool_op__missing_rhs.py.snap | 3 +- ...xpressions__compare__invalid_order.py.snap | 5 +- ...s__compare__invalid_rhs_expression.py.snap | 5 +- ...@expressions__compare__missing_lhs.py.snap | 3 +- ...xpressions__compare__missing_rhs_0.py.snap | 3 +- ...xpressions__compare__missing_rhs_1.py.snap | 5 +- ...xpressions__compare__missing_rhs_2.py.snap | 3 +- ...sions__compare__starred_expression.py.snap | 5 +- ...x@expressions__dict__comprehension.py.snap | 5 +- ...tax@expressions__dict__double_star.py.snap | 5 +- ...s__dict__double_star_comprehension.py.snap | 21 ++- ...ons__dict__missing_closing_brace_2.py.snap | 3 +- ...ressions__dict__named_expression_0.py.snap | 9 +- ...ressions__dict__named_expression_1.py.snap | 17 +-- ..._syntax@expressions__dict__recover.py.snap | 19 ++- ...tax@expressions__emoji_identifiers.py.snap | 7 +- ...essions__if__missing_orelse_expr_0.py.snap | 3 +- ...essions__if__missing_orelse_expr_1.py.snap | 3 +- ...pressions__if__missing_test_expr_0.py.snap | 3 +- ...pressions__if__missing_test_expr_1.py.snap | 3 +- ...id_syntax@expressions__if__recover.py.snap | 3 +- ...sions__lambda_duplicate_parameters.py.snap | 19 ++- ...x@expressions__list__comprehension.py.snap | 7 +- ...s__list__missing_closing_bracket_3.py.snap | 5 +- ..._syntax@expressions__list__recover.py.snap | 25 ++-- ...__list__star_expression_precedence.py.snap | 3 +- ...expressions__named__invalid_target.py.snap | 3 +- ...sions__named__missing_expression_4.py.snap | 5 +- ...nthesized__missing_closing_paren_3.py.snap | 5 +- ...ions__parenthesized__parenthesized.py.snap | 3 +- ...@expressions__parenthesized__tuple.py.snap | 41 +++-- ..._parenthesized__tuple_starred_expr.py.snap | 5 +- ...ax@expressions__set__comprehension.py.snap | 7 +- ...set__missing_closing_curly_brace_3.py.snap | 5 +- ...d_syntax@expressions__set__recover.py.snap | 23 ++- ...s__set__star_expression_precedence.py.snap | 3 +- ...__subscript__invalid_slice_element.py.snap | 7 +- ...xpressions__unary__no_expression_0.py.snap | 3 +- ...xpressions__unary__no_expression_1.py.snap | 3 +- ...pressions__yield__named_expression.py.snap | 5 +- ...xpressions__yield__star_expression.py.snap | 5 +- ...ns__yield_from__starred_expression.py.snap | 3 +- ...sions__yield_from__unparenthesized.py.snap | 5 +- ...tax@re_lexing__line_continuation_1.py.snap | 7 +- ...atements__function_type_parameters.py.snap | 29 ++-- ...ements__invalid_assignment_targets.py.snap | 21 ++- ...nvalid_augmented_assignment_target.py.snap | 11 +- ...s__with__ambiguous_lpar_with_items.py.snap | 29 ++-- ...statements__with__empty_with_items.py.snap | 5 +- ...__with__unparenthesized_with_items.py.snap | 3 +- 779 files changed, 3619 insertions(+), 4333 deletions(-) diff --git a/crates/ruff/tests/integration_test.rs b/crates/ruff/tests/integration_test.rs index bae45dd22f..c9f1a67459 100644 --- a/crates/ruff/tests/integration_test.rs +++ b/crates/ruff/tests/integration_test.rs @@ -623,7 +623,7 @@ fn stdin_override_parser_py() { fn stdin_fix_when_not_fixable_should_still_print_contents() { let mut cmd = RuffCheck::default().args(["--fix"]).build(); assert_cmd_snapshot!(cmd - .pass_stdin("import os\nimport sys\n\nif (1, 2):\n print(sys.version)\n"), @r" + .pass_stdin("import os\nimport sys\n\nif (1, 2):\n print(sys.version)\n"), @r###" success: false exit_code: 1 ----- stdout ----- @@ -636,14 +636,14 @@ fn stdin_fix_when_not_fixable_should_still_print_contents() { -:3:4: F634 If test is a tuple, which is always `True` | 1 | import sys - 2 | + 2 | 3 | if (1, 2): | ^^^^^^ F634 4 | print(sys.version) | Found 2 errors (1 fixed, 1 remaining). - "); + "###); } #[test] diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap index af1c20d90c..3d8a6d9c4b 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__notebook_output.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_linter/src/message/text.rs expression: content -snapshot_kind: text --- notebook.ipynb:cell 1:2:8: F401 [*] `os` imported but unused | @@ -16,7 +15,7 @@ notebook.ipynb:cell 2:2:8: F401 [*] `math` imported but unused 1 | # cell 2 2 | import math | ^^^^ F401 -3 | +3 | 4 | print('hello world') | = help: Remove unused import: `math` diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap index 2595f4eaa7..b0cb408580 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__syntax_errors.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/message/text.rs expression: content -snapshot_kind: text --- syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import | 1 | from os import | ^ -2 | +2 | 3 | if call(foo 4 | def bar(): | @@ -15,7 +14,7 @@ syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after impo syntax_errors.py:3:12: SyntaxError: Expected ')', found newline | 1 | from os import -2 | +2 | 3 | if call(foo | ^ 4 | def bar(): diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap index 1da4d56d20..c2ed187615 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR001_AIR001.py.snap @@ -6,7 +6,7 @@ AIR001.py:11:1: AIR001 Task variable name should match the `task_id`: "my_task" 10 | my_task = PythonOperator(task_id="my_task", callable=my_callable) 11 | incorrect_name = PythonOperator(task_id="my_task") # AIR001 | ^^^^^^^^^^^^^^ AIR001 -12 | +12 | 13 | my_task = AirbyteTriggerSyncOperator(task_id="my_task", callable=my_callable) | @@ -15,7 +15,7 @@ AIR001.py:14:1: AIR001 Task variable name should match the `task_id`: "my_task" 13 | my_task = AirbyteTriggerSyncOperator(task_id="my_task", callable=my_callable) 14 | incorrect_name = AirbyteTriggerSyncOperator(task_id="my_task") # AIR001 | ^^^^^^^^^^^^^^ AIR001 -15 | +15 | 16 | my_task = AppflowFlowRunOperator(task_id="my_task", callable=my_callable) | @@ -24,6 +24,6 @@ AIR001.py:17:1: AIR001 Task variable name should match the `task_id`: "my_task" 16 | my_task = AppflowFlowRunOperator(task_id="my_task", callable=my_callable) 17 | incorrect_name = AppflowFlowRunOperator(task_id="my_task") # AIR001 | ^^^^^^^^^^^^^^ AIR001 -18 | +18 | 19 | # Consider only from the `airflow.operators` (or providers operators) module | diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR301_AIR301.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR301_AIR301.py.snap index d25605ac55..6407aa9ab2 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR301_AIR301.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR301_AIR301.py.snap @@ -4,10 +4,10 @@ source: crates/ruff_linter/src/rules/airflow/mod.rs AIR301.py:4:1: AIR301 DAG should have an explicit `schedule` argument | 2 | from airflow.timetables.simple import NullTimetable -3 | +3 | 4 | DAG(dag_id="class_default_schedule") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301 -5 | +5 | 6 | DAG(dag_id="class_schedule", schedule="@hourly") | diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_args.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_args.py.snap index 1f9f4a94f2..77cd842f09 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_args.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_args.py.snap @@ -4,10 +4,10 @@ source: crates/ruff_linter/src/rules/airflow/mod.rs AIR302_args.py:18:39: AIR302 [*] `schedule_interval` is removed in Airflow 3.0 | 16 | DAG(dag_id="class_schedule", schedule="@hourly") -17 | +17 | 18 | DAG(dag_id="class_schedule_interval", schedule_interval="@hourly") | ^^^^^^^^^^^^^^^^^ AIR302 -19 | +19 | 20 | DAG(dag_id="class_timetable", timetable=NullTimetable()) | = help: Use `schedule` instead @@ -25,7 +25,7 @@ AIR302_args.py:18:39: AIR302 [*] `schedule_interval` is removed in Airflow 3.0 AIR302_args.py:20:31: AIR302 [*] `timetable` is removed in Airflow 3.0 | 18 | DAG(dag_id="class_schedule_interval", schedule_interval="@hourly") -19 | +19 | 20 | DAG(dag_id="class_timetable", timetable=NullTimetable()) | ^^^^^^^^^ AIR302 | @@ -238,14 +238,14 @@ AIR302_args.py:90:16: AIR302 `filename_template` is removed in Airflow 3.0 89 | ElasticsearchTaskHandler(filename_template="/tmp/test") 90 | GCSTaskHandler(filename_template="/tmp/test") | ^^^^^^^^^^^^^^^^^ AIR302 -91 | +91 | 92 | FabAuthManager(None) | AIR302_args.py:92:15: AIR302 `appbuilder` is removed in Airflow 3.0; The constructor takes no parameter now | 90 | GCSTaskHandler(filename_template="/tmp/test") -91 | +91 | 92 | FabAuthManager(None) | ^^^^^^ AIR302 | diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_class_attribute.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_class_attribute.py.snap index 4066c8e63d..bdea27dfc9 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_class_attribute.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_class_attribute.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/airflow/mod.rs -snapshot_kind: text --- AIR302_class_attribute.py:13:4: AIR302 `register_dataset_change` is removed in Airflow 3.0 | @@ -50,7 +49,7 @@ AIR302_class_attribute.py:17:4: AIR302 `notify_dataset_alias_created` is removed 16 | dm.notify_dataset_changed() 17 | dm.notify_dataset_alias_created() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -18 | +18 | 19 | hlc = HookLineageCollector() | = help: Use `notify_asset_alias_created` instead @@ -92,7 +91,7 @@ AIR302_class_attribute.py:23:5: AIR302 `collected_datasets` is removed in Airflo 22 | hlc.add_output_dataset() 23 | hlc.collected_datasets() | ^^^^^^^^^^^^^^^^^^ AIR302 -24 | +24 | 25 | aam = AwsAuthManager() | = help: Use `collected_assets` instead @@ -102,7 +101,7 @@ AIR302_class_attribute.py:26:5: AIR302 `is_authorized_dataset` is removed in Air 25 | aam = AwsAuthManager() 26 | aam.is_authorized_dataset() | ^^^^^^^^^^^^^^^^^^^^^ AIR302 -27 | +27 | 28 | pm = ProvidersManager() | = help: Use `is_authorized_asset` instead @@ -113,7 +112,7 @@ AIR302_class_attribute.py:30:4: AIR302 `dataset_factories` is removed in Airflow 29 | pm.initialize_providers_asset_uri_resources() 30 | pm.dataset_factories | ^^^^^^^^^^^^^^^^^ AIR302 -31 | +31 | 32 | base_secret_backend = BaseSecretsBackend() | = help: Use `asset_factories` instead @@ -133,7 +132,7 @@ AIR302_class_attribute.py:34:21: AIR302 `get_connections` is removed in Airflow 33 | base_secret_backend.get_conn_uri() 34 | base_secret_backend.get_connections() | ^^^^^^^^^^^^^^^ AIR302 -35 | +35 | 36 | csm_backend = CloudSecretManagerBackend() | = help: Use `get_connection` instead @@ -153,7 +152,7 @@ AIR302_class_attribute.py:38:13: AIR302 `get_connections` is removed in Airflow 37 | csm_backend.get_conn_uri() 38 | csm_backend.get_connections() | ^^^^^^^^^^^^^^^ AIR302 -39 | +39 | 40 | vault_backend = VaultBackend() | = help: Use `get_connection` instead @@ -173,7 +172,7 @@ AIR302_class_attribute.py:42:15: AIR302 `get_connections` is removed in Airflow 41 | vault_backend.get_conn_uri() 42 | vault_backend.get_connections() | ^^^^^^^^^^^^^^^ AIR302 -43 | +43 | 44 | not_an_error = NotAir302SecretError() | = help: Use `get_connection` instead @@ -204,7 +203,7 @@ AIR302_class_attribute.py:56:18: AIR302 `dataset_to_openlineage_converters` is r 55 | provider_manager.dataset_uri_handlers 56 | provider_manager.dataset_to_openlineage_converters | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -57 | +57 | 58 | dl_info = DatasetLineageInfo() | = help: Use `asset_to_openlineage_converters` instead @@ -212,7 +211,7 @@ AIR302_class_attribute.py:56:18: AIR302 `dataset_to_openlineage_converters` is r AIR302_class_attribute.py:58:11: AIR302 `airflow.lineage.hook.DatasetLineageInfo` is removed in Airflow 3.0 | 56 | provider_manager.dataset_to_openlineage_converters -57 | +57 | 58 | dl_info = DatasetLineageInfo() | ^^^^^^^^^^^^^^^^^^ AIR302 59 | dl_info.dataset diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_names.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_names.py.snap index 03104f2eee..7576338928 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_names.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR302_AIR302_names.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/airflow/mod.rs -snapshot_kind: text --- AIR302_names.py:105:1: AIR302 `airflow.PY36` is removed in Airflow 3.0 | @@ -71,7 +70,7 @@ AIR302_names.py:106:1: AIR302 `airflow.Dataset` is removed in Airflow 3.0 105 | PY36, PY37, PY38, PY39, PY310, PY311, PY312 106 | DatasetFromRoot() | ^^^^^^^^^^^^^^^ AIR302 -107 | +107 | 108 | dataset_from_root = DatasetFromRoot() | = help: Use `airflow.sdk.definitions.asset.Asset` instead @@ -79,7 +78,7 @@ AIR302_names.py:106:1: AIR302 `airflow.Dataset` is removed in Airflow 3.0 AIR302_names.py:108:21: AIR302 `airflow.Dataset` is removed in Airflow 3.0 | 106 | DatasetFromRoot() -107 | +107 | 108 | dataset_from_root = DatasetFromRoot() | ^^^^^^^^^^^^^^^ AIR302 109 | dataset_from_root.iter_datasets() @@ -102,7 +101,7 @@ AIR302_names.py:110:19: AIR302 `iter_dataset_aliases` is removed in Airflow 3.0 109 | dataset_from_root.iter_datasets() 110 | dataset_from_root.iter_dataset_aliases() | ^^^^^^^^^^^^^^^^^^^^ AIR302 -111 | +111 | 112 | # airflow.api_connexion.security | = help: Use `iter_asset_aliases` instead @@ -112,7 +111,7 @@ AIR302_names.py:113:1: AIR302 `airflow.api_connexion.security.requires_access` i 112 | # airflow.api_connexion.security 113 | requires_access, requires_access_dataset | ^^^^^^^^^^^^^^^ AIR302 -114 | +114 | 115 | # airflow.auth.managers | = help: Use `airflow.api_connexion.security.requires_access_*` instead @@ -122,7 +121,7 @@ AIR302_names.py:113:18: AIR302 `airflow.api_connexion.security.requires_access_d 112 | # airflow.api_connexion.security 113 | requires_access, requires_access_dataset | ^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -114 | +114 | 115 | # airflow.auth.managers | = help: Use `airflow.api_connexion.security.requires_access_asset` instead @@ -142,7 +141,7 @@ AIR302_names.py:117:1: AIR302 `airflow.auth.managers.models.resource_details.Dat 116 | is_authorized_dataset 117 | DatasetDetails() | ^^^^^^^^^^^^^^ AIR302 -118 | +118 | 119 | # airflow.configuration | = help: Use `airflow.auth.managers.models.resource_details.AssetDetails` instead @@ -216,7 +215,7 @@ AIR302_names.py:124:1: AIR302 `airflow.contrib.aws_athena_hook.AWSAthenaHook` is 123 | # airflow.contrib.* 124 | AWSAthenaHook() | ^^^^^^^^^^^^^ AIR302 -125 | +125 | 126 | # airflow.datasets | @@ -289,7 +288,7 @@ AIR302_names.py:133:1: AIR302 `airflow.datasets.metadata.Metadata` is removed in 132 | expand_alias_to_datasets 133 | Metadata() | ^^^^^^^^ AIR302 -134 | +134 | 135 | dataset_to_test_method_call = Dataset() | = help: Use `airflow.sdk.definitions.asset.metadata.Metadata` instead @@ -297,7 +296,7 @@ AIR302_names.py:133:1: AIR302 `airflow.datasets.metadata.Metadata` is removed in AIR302_names.py:135:31: AIR302 `airflow.datasets.Dataset` is removed in Airflow 3.0 | 133 | Metadata() -134 | +134 | 135 | dataset_to_test_method_call = Dataset() | ^^^^^^^ AIR302 136 | dataset_to_test_method_call.iter_datasets() @@ -320,7 +319,7 @@ AIR302_names.py:137:29: AIR302 `iter_dataset_aliases` is removed in Airflow 3.0 136 | dataset_to_test_method_call.iter_datasets() 137 | dataset_to_test_method_call.iter_dataset_aliases() | ^^^^^^^^^^^^^^^^^^^^ AIR302 -138 | +138 | 139 | alias_to_test_method_call = DatasetAlias() | = help: Use `iter_asset_aliases` instead @@ -328,7 +327,7 @@ AIR302_names.py:137:29: AIR302 `iter_dataset_aliases` is removed in Airflow 3.0 AIR302_names.py:139:29: AIR302 `airflow.datasets.DatasetAlias` is removed in Airflow 3.0 | 137 | dataset_to_test_method_call.iter_dataset_aliases() -138 | +138 | 139 | alias_to_test_method_call = DatasetAlias() | ^^^^^^^^^^^^ AIR302 140 | alias_to_test_method_call.iter_datasets() @@ -351,7 +350,7 @@ AIR302_names.py:141:27: AIR302 `iter_dataset_aliases` is removed in Airflow 3.0 140 | alias_to_test_method_call.iter_datasets() 141 | alias_to_test_method_call.iter_dataset_aliases() | ^^^^^^^^^^^^^^^^^^^^ AIR302 -142 | +142 | 143 | any_to_test_method_call = DatasetAny() | = help: Use `iter_asset_aliases` instead @@ -359,7 +358,7 @@ AIR302_names.py:141:27: AIR302 `iter_dataset_aliases` is removed in Airflow 3.0 AIR302_names.py:143:27: AIR302 `airflow.datasets.DatasetAny` is removed in Airflow 3.0 | 141 | alias_to_test_method_call.iter_dataset_aliases() -142 | +142 | 143 | any_to_test_method_call = DatasetAny() | ^^^^^^^^^^ AIR302 144 | any_to_test_method_call.iter_datasets() @@ -382,7 +381,7 @@ AIR302_names.py:145:25: AIR302 `iter_dataset_aliases` is removed in Airflow 3.0 144 | any_to_test_method_call.iter_datasets() 145 | any_to_test_method_call.iter_dataset_aliases() | ^^^^^^^^^^^^^^^^^^^^ AIR302 -146 | +146 | 147 | # airflow.datasets.manager | = help: Use `iter_asset_aliases` instead @@ -392,7 +391,7 @@ AIR302_names.py:148:19: AIR302 `airflow.datasets.manager.dataset_manager` is rem 147 | # airflow.datasets.manager 148 | DatasetManager(), dataset_manager, resolve_dataset_manager | ^^^^^^^^^^^^^^^ AIR302 -149 | +149 | 150 | # airflow.hooks | = help: Use `airflow.assets.manager` instead @@ -402,7 +401,7 @@ AIR302_names.py:148:36: AIR302 `airflow.datasets.manager.resolve_dataset_manager 147 | # airflow.datasets.manager 148 | DatasetManager(), dataset_manager, resolve_dataset_manager | ^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -149 | +149 | 150 | # airflow.hooks | = help: Use `airflow.assets.resolve_asset_manager` instead @@ -412,7 +411,7 @@ AIR302_names.py:151:1: AIR302 `airflow.hooks.base_hook.BaseHook` is removed in A 150 | # airflow.hooks 151 | BaseHook() | ^^^^^^^^ AIR302 -152 | +152 | 153 | # airflow.lineage.hook | = help: Use `airflow.hooks.base.BaseHook` instead @@ -422,7 +421,7 @@ AIR302_names.py:154:1: AIR302 `airflow.lineage.hook.DatasetLineageInfo` is remov 153 | # airflow.lineage.hook 154 | DatasetLineageInfo() | ^^^^^^^^^^^^^^^^^^ AIR302 -155 | +155 | 156 | # airflow.listeners.spec.dataset | = help: Use `airflow.lineage.hook.AssetLineageInfo` instead @@ -432,7 +431,7 @@ AIR302_names.py:157:1: AIR302 `airflow.listeners.spec.dataset.on_dataset_changed 156 | # airflow.listeners.spec.dataset 157 | on_dataset_changed, on_dataset_created | ^^^^^^^^^^^^^^^^^^ AIR302 -158 | +158 | 159 | # airflow.metrics.validators | = help: Use `airflow.listeners.spec.asset.on_asset_changed` instead @@ -442,7 +441,7 @@ AIR302_names.py:157:21: AIR302 `airflow.listeners.spec.dataset.on_dataset_create 156 | # airflow.listeners.spec.dataset 157 | on_dataset_changed, on_dataset_created | ^^^^^^^^^^^^^^^^^^ AIR302 -158 | +158 | 159 | # airflow.metrics.validators | = help: Use `airflow.listeners.spec.asset.on_asset_created` instead @@ -452,7 +451,7 @@ AIR302_names.py:160:1: AIR302 `airflow.metrics.validators.AllowListValidator` is 159 | # airflow.metrics.validators 160 | AllowListValidator(), BlockListValidator() | ^^^^^^^^^^^^^^^^^^ AIR302 -161 | +161 | 162 | # airflow.operators.dummy_operator | = help: Use `airflow.metrics.validators.PatternAllowListValidator` instead @@ -462,7 +461,7 @@ AIR302_names.py:160:23: AIR302 `airflow.metrics.validators.BlockListValidator` i 159 | # airflow.metrics.validators 160 | AllowListValidator(), BlockListValidator() | ^^^^^^^^^^^^^^^^^^ AIR302 -161 | +161 | 162 | # airflow.operators.dummy_operator | = help: Use `airflow.metrics.validators.PatternBlockListValidator` instead @@ -482,7 +481,7 @@ AIR302_names.py:164:16: AIR302 `airflow.operators.dummy_operator.DummyOperator` 163 | dummy_operator.EmptyOperator() 164 | dummy_operator.DummyOperator() | ^^^^^^^^^^^^^ AIR302 -165 | +165 | 166 | # airflow.operators.bash_operator | = help: Use `airflow.operators.empty.EmptyOperator` instead @@ -492,7 +491,7 @@ AIR302_names.py:167:1: AIR302 `airflow.operators.bash_operator.BashOperator` is 166 | # airflow.operators.bash_operator 167 | BashOperator() | ^^^^^^^^^^^^ AIR302 -168 | +168 | 169 | # airflow.operators.branch_operator | = help: Use `airflow.operators.bash.BashOperator` instead @@ -502,7 +501,7 @@ AIR302_names.py:170:1: AIR302 `airflow.operators.branch_operator.BaseBranchOpera 169 | # airflow.operators.branch_operator 170 | BaseBranchOperator() | ^^^^^^^^^^^^^^^^^^ AIR302 -171 | +171 | 172 | # airflow.operators.dagrun_operator | = help: Use `airflow.operators.branch.BaseBranchOperator` instead @@ -522,7 +521,7 @@ AIR302_names.py:174:1: AIR302 `airflow.operators.dagrun_operator.TriggerDagRunOp 173 | TriggerDagRunLink() 174 | TriggerDagRunOperator() | ^^^^^^^^^^^^^^^^^^^^^ AIR302 -175 | +175 | 176 | # airflow.operators.dummy | = help: Use `airflow.operators.trigger_dagrun.TriggerDagRunOperator` instead @@ -532,7 +531,7 @@ AIR302_names.py:177:18: AIR302 `airflow.operators.dummy.DummyOperator` is remove 176 | # airflow.operators.dummy 177 | EmptyOperator(), DummyOperator() | ^^^^^^^^^^^^^ AIR302 -178 | +178 | 179 | # airflow.operators.email_operator | = help: Use `airflow.operators.empty.EmptyOperator` instead @@ -542,7 +541,7 @@ AIR302_names.py:180:1: AIR302 `airflow.operators.email_operator.EmailOperator` i 179 | # airflow.operators.email_operator 180 | EmailOperator() | ^^^^^^^^^^^^^ AIR302 -181 | +181 | 182 | # airflow.operators.latest_only_operator | = help: Use `airflow.operators.email.EmailOperator` instead @@ -552,7 +551,7 @@ AIR302_names.py:183:1: AIR302 `airflow.operators.latest_only_operator.LatestOnly 182 | # airflow.operators.latest_only_operator 183 | LatestOnlyOperator() | ^^^^^^^^^^^^^^^^^^ AIR302 -184 | +184 | 185 | # airflow.operators.python_operator | = help: Use `airflow.operators.latest_only.LatestOnlyOperator` instead @@ -594,7 +593,7 @@ AIR302_names.py:189:1: AIR302 `airflow.operators.python_operator.ShortCircuitOpe 188 | PythonVirtualenvOperator() 189 | ShortCircuitOperator() | ^^^^^^^^^^^^^^^^^^^^ AIR302 -190 | +190 | 191 | # airflow.operators.subdag.* | = help: Use `airflow.operators.python.ShortCircuitOperator` instead @@ -604,7 +603,7 @@ AIR302_names.py:192:1: AIR302 `airflow.operators.subdag.SubDagOperator` is remov 191 | # airflow.operators.subdag.* 192 | SubDagOperator() | ^^^^^^^^^^^^^^ AIR302 -193 | +193 | 194 | # airflow.providers.amazon | @@ -645,7 +644,7 @@ AIR302_names.py:198:4: AIR302 `airflow.providers.amazon.aws.datasets.s3.sanitize 197 | s3.convert_dataset_to_openlineage 198 | s3.sanitize_uri | ^^^^^^^^^^^^ AIR302 -199 | +199 | 200 | # airflow.providers.common.io | = help: Use `airflow.providers.amazon.aws.assets.s3.sanitize_uri` instead @@ -676,7 +675,7 @@ AIR302_names.py:203:16: AIR302 `airflow.providers.common.io.datasets.file.saniti 202 | common_io_file.create_dataset 203 | common_io_file.sanitize_uri | ^^^^^^^^^^^^ AIR302 -204 | +204 | 205 | # airflow.providers.fab | = help: Use `airflow.providers.common.io.assets.file.sanitize_uri` instead @@ -686,7 +685,7 @@ AIR302_names.py:206:18: AIR302 `airflow.providers.fab.auth_manager.fab_auth_mana 205 | # airflow.providers.fab 206 | fab_auth_manager.is_authorized_dataset | ^^^^^^^^^^^^^^^^^^^^^ AIR302 -207 | +207 | 208 | # airflow.providers.google | = help: Use `airflow.providers.fab.auth_manager.fab_auth_manager.is_authorized_asset` instead @@ -694,7 +693,7 @@ AIR302_names.py:206:18: AIR302 `airflow.providers.fab.auth_manager.fab_auth_mana AIR302_names.py:211:5: AIR302 `airflow.providers.google.datasets.gcs.create_dataset` is removed in Airflow 3.0 | 209 | bigquery.sanitize_uri -210 | +210 | 211 | gcs.create_dataset | ^^^^^^^^^^^^^^ AIR302 212 | gcs.sanitize_uri @@ -717,7 +716,7 @@ AIR302_names.py:213:5: AIR302 `airflow.providers.google.datasets.gcs.convert_dat 212 | gcs.sanitize_uri 213 | gcs.convert_dataset_to_openlineage | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -214 | +214 | 215 | # airflow.providers.mysql | = help: Use `airflow.providers.google.assets.gcs.convert_asset_to_openlineage` instead @@ -727,7 +726,7 @@ AIR302_names.py:216:7: AIR302 `airflow.providers.mysql.datasets.mysql.sanitize_u 215 | # airflow.providers.mysql 216 | mysql.sanitize_uri | ^^^^^^^^^^^^ AIR302 -217 | +217 | 218 | # airflow.providers.openlineage | = help: Use `airflow.providers.mysql.assets.mysql.sanitize_uri` instead @@ -737,7 +736,7 @@ AIR302_names.py:219:1: AIR302 `airflow.providers.openlineage.utils.utils.Dataset 218 | # airflow.providers.openlineage 219 | DatasetInfo(), translate_airflow_dataset | ^^^^^^^^^^^ AIR302 -220 | +220 | 221 | # airflow.providers.postgres | = help: Use `airflow.providers.openlineage.utils.utils.AssetInfo` instead @@ -747,7 +746,7 @@ AIR302_names.py:219:16: AIR302 `airflow.providers.openlineage.utils.utils.transl 218 | # airflow.providers.openlineage 219 | DatasetInfo(), translate_airflow_dataset | ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -220 | +220 | 221 | # airflow.providers.postgres | = help: Use `airflow.providers.openlineage.utils.utils.translate_airflow_asset` instead @@ -757,7 +756,7 @@ AIR302_names.py:222:10: AIR302 `airflow.providers.postgres.datasets.postgres.san 221 | # airflow.providers.postgres 222 | postgres.sanitize_uri | ^^^^^^^^^^^^ AIR302 -223 | +223 | 224 | # airflow.providers.trino | = help: Use `airflow.providers.postgres.assets.postgres.sanitize_uri` instead @@ -767,7 +766,7 @@ AIR302_names.py:225:7: AIR302 `airflow.providers.trino.datasets.trino.sanitize_u 224 | # airflow.providers.trino 225 | trino.sanitize_uri | ^^^^^^^^^^^^ AIR302 -226 | +226 | 227 | # airflow.secrets | = help: Use `airflow.providers.trino.assets.trino.sanitize_uri` instead @@ -777,7 +776,7 @@ AIR302_names.py:228:1: AIR302 `airflow.secrets.local_filesystem.get_connection` 227 | # airflow.secrets 228 | get_connection, load_connections | ^^^^^^^^^^^^^^ AIR302 -229 | +229 | 230 | # airflow.security.permissions | = help: Use `airflow.secrets.local_filesystem.load_connections_dict` instead @@ -787,7 +786,7 @@ AIR302_names.py:228:17: AIR302 `airflow.secrets.local_filesystem.load_connection 227 | # airflow.secrets 228 | get_connection, load_connections | ^^^^^^^^^^^^^^^^ AIR302 -229 | +229 | 230 | # airflow.security.permissions | = help: Use `airflow.secrets.local_filesystem.load_connections_dict` instead @@ -797,7 +796,7 @@ AIR302_names.py:231:1: AIR302 `airflow.security.permissions.RESOURCE_DATASET` is 230 | # airflow.security.permissions 231 | RESOURCE_DATASET | ^^^^^^^^^^^^^^^^ AIR302 -232 | +232 | 233 | # airflow.sensors.base_sensor_operator | = help: Use `airflow.security.permissions.RESOURCE_ASSET` instead @@ -807,7 +806,7 @@ AIR302_names.py:234:1: AIR302 `airflow.sensors.base_sensor_operator.BaseSensorOp 233 | # airflow.sensors.base_sensor_operator 234 | BaseSensorOperator() | ^^^^^^^^^^^^^^^^^^ AIR302 -235 | +235 | 236 | # airflow.sensors.date_time_sensor | = help: Use `airflow.sensors.base.BaseSensorOperator` instead @@ -817,7 +816,7 @@ AIR302_names.py:237:1: AIR302 `airflow.sensors.date_time_sensor.DateTimeSensor` 236 | # airflow.sensors.date_time_sensor 237 | DateTimeSensor() | ^^^^^^^^^^^^^^ AIR302 -238 | +238 | 239 | # airflow.sensors.external_task | = help: Use `airflow.sensors.date_time.DateTimeSensor` instead @@ -827,7 +826,7 @@ AIR302_names.py:240:1: AIR302 `airflow.sensors.external_task.ExternalTaskSensorL 239 | # airflow.sensors.external_task 240 | ExternalTaskSensorLinkFromExternalTask() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -241 | +241 | 242 | # airflow.sensors.external_task_sensor | = help: Use `airflow.sensors.external_task.ExternalDagLink` instead @@ -858,7 +857,7 @@ AIR302_names.py:245:1: AIR302 `airflow.sensors.external_task_sensor.ExternalTask 244 | ExternalTaskSensor() 245 | ExternalTaskSensorLinkFromExternalTaskSensor() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -246 | +246 | 247 | # airflow.sensors.time_delta_sensor | = help: Use `airflow.sensors.external_task.ExternalDagLink` instead @@ -868,7 +867,7 @@ AIR302_names.py:248:1: AIR302 `airflow.sensors.time_delta_sensor.TimeDeltaSensor 247 | # airflow.sensors.time_delta_sensor 248 | TimeDeltaSensor() | ^^^^^^^^^^^^^^^ AIR302 -249 | +249 | 250 | # airflow.timetables | = help: Use `airflow.sensors.time_delta.TimeDeltaSensor` instead @@ -888,7 +887,7 @@ AIR302_names.py:252:1: AIR302 `airflow.timetables.simple.DatasetTriggeredTimetab 251 | DatasetOrTimeSchedule() 252 | DatasetTriggeredTimetable() | ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302 -253 | +253 | 254 | # airflow.triggers.external_task | = help: Use `airflow.timetables.simple.AssetTriggeredTimetable` instead @@ -898,7 +897,7 @@ AIR302_names.py:255:1: AIR302 `airflow.triggers.external_task.TaskStateTrigger` 254 | # airflow.triggers.external_task 255 | TaskStateTrigger() | ^^^^^^^^^^^^^^^^ AIR302 -256 | +256 | 257 | # airflow.utils.date | @@ -917,7 +916,7 @@ AIR302_names.py:259:7: AIR302 `airflow.utils.dates.days_ago` is removed in Airfl 258 | dates.date_range 259 | dates.days_ago | ^^^^^^^^ AIR302 -260 | +260 | 261 | date_range | = help: Use `pendulum.today('UTC').add(days=-N, ...)` instead @@ -925,7 +924,7 @@ AIR302_names.py:259:7: AIR302 `airflow.utils.dates.days_ago` is removed in Airfl AIR302_names.py:261:1: AIR302 `airflow.utils.dates.date_range` is removed in Airflow 3.0 | 259 | dates.days_ago -260 | +260 | 261 | date_range | ^^^^^^^^^^ AIR302 262 | days_ago @@ -978,7 +977,7 @@ AIR302_names.py:266:1: AIR302 `airflow.utils.dates.scale_time_units` is removed 265 | round_time 266 | scale_time_units | ^^^^^^^^^^^^^^^^ AIR302 -267 | +267 | 268 | # This one was not deprecated. | @@ -987,7 +986,7 @@ AIR302_names.py:273:1: AIR302 `airflow.utils.dag_cycle_tester.test_cycle` is rem 272 | # airflow.utils.dag_cycle_tester 273 | test_cycle | ^^^^^^^^^^ AIR302 -274 | +274 | 275 | # airflow.utils.decorators | @@ -996,7 +995,7 @@ AIR302_names.py:276:1: AIR302 `airflow.utils.decorators.apply_defaults` is remov 275 | # airflow.utils.decorators 276 | apply_defaults | ^^^^^^^^^^^^^^ AIR302 -277 | +277 | 278 | # airflow.utils.file | @@ -1005,7 +1004,7 @@ AIR302_names.py:279:22: AIR302 `airflow.utils.file.mkdirs` is removed in Airflow 278 | # airflow.utils.file 279 | TemporaryDirector(), mkdirs | ^^^^^^ AIR302 -280 | +280 | 281 | # airflow.utils.helpers | = help: Use `pendulum.today('UTC').add(days=-N, ...)` instead @@ -1015,7 +1014,7 @@ AIR302_names.py:282:1: AIR302 `airflow.utils.helpers.chain` is removed in Airflo 281 | # airflow.utils.helpers 282 | chain, cross_downstream | ^^^^^ AIR302 -283 | +283 | 284 | # airflow.utils.state | = help: Use `airflow.models.baseoperator.chain` instead @@ -1025,7 +1024,7 @@ AIR302_names.py:282:8: AIR302 `airflow.utils.helpers.cross_downstream` is remove 281 | # airflow.utils.helpers 282 | chain, cross_downstream | ^^^^^^^^^^^^^^^^ AIR302 -283 | +283 | 284 | # airflow.utils.state | = help: Use `airflow.models.baseoperator.cross_downstream` instead @@ -1035,7 +1034,7 @@ AIR302_names.py:285:1: AIR302 `airflow.utils.state.SHUTDOWN` is removed in Airfl 284 | # airflow.utils.state 285 | SHUTDOWN, terminating_states | ^^^^^^^^ AIR302 -286 | +286 | 287 | # airflow.utils.trigger_rule | @@ -1044,7 +1043,7 @@ AIR302_names.py:285:11: AIR302 `airflow.utils.state.terminating_states` is remov 284 | # airflow.utils.state 285 | SHUTDOWN, terminating_states | ^^^^^^^^^^^^^^^^^^ AIR302 -286 | +286 | 287 | # airflow.utils.trigger_rule | @@ -1062,7 +1061,7 @@ AIR302_names.py:289:13: AIR302 `airflow.utils.trigger_rule.TriggerRule.NONE_FAIL 288 | TriggerRule.DUMMY 289 | TriggerRule.NONE_FAILED_OR_SKIPPED | ^^^^^^^^^^^^^^^^^^^^^^ AIR302 -290 | +290 | 291 | # airflow.www.auth | @@ -1081,7 +1080,7 @@ AIR302_names.py:293:1: AIR302 `airflow.www.auth.has_access_dataset` is removed i 292 | has_access 293 | has_access_dataset | ^^^^^^^^^^^^^^^^^^ AIR302 -294 | +294 | 295 | # airflow.www.utils | = help: Use `airflow.www.auth.has_access_dataset.has_access_asset` instead diff --git a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR303_AIR303.py.snap b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR303_AIR303.py.snap index b4404f2320..102768106e 100644 --- a/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR303_AIR303.py.snap +++ b/crates/ruff_linter/src/rules/airflow/snapshots/ruff_linter__rules__airflow__tests__AIR303_AIR303.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/airflow/mod.rs -snapshot_kind: text --- AIR303.py:159:1: AIR303 `airflow.hooks.S3_hook.provide_bucket_name` is moved into `amazon` provider in Airflow 3.0; | @@ -116,7 +115,7 @@ AIR303.py:169:1: AIR303 `airflow.operators.s3_to_redshift_operator.S3ToRedshiftT 168 | S3ToRedshiftOperator() 169 | S3ToRedshiftTransfer() | ^^^^^^^^^^^^^^^^^^^^ AIR303 -170 | +170 | 171 | # apache-airflow-providers-celery | = help: Install `apache-airflow-provider-amazon>=1.0.0` and use `airflow.providers.amazon.aws.transfers.s3_to_redshift.S3ToRedshiftOperator` instead. @@ -158,7 +157,7 @@ AIR303.py:175:1: AIR303 `airflow.executors.celery_kubernetes_executor.CeleryKube 174 | CeleryExecutor() 175 | CeleryKubernetesExecutor() | ^^^^^^^^^^^^^^^^^^^^^^^^ AIR303 -176 | +176 | 177 | # apache-airflow-providers-common-sql | = help: Install `apache-airflow-provider-celery>=3.3.0` and use `airflow.providers.celery.executors.celery_kubernetes_executor.CeleryKubernetesExecutor` instead. @@ -453,7 +452,7 @@ AIR303.py:206:1: AIR303 `airflow.operators.check_operator.ValueCheckOperator` is 205 | ThresholdCheckOperator() 206 | ValueCheckOperator() | ^^^^^^^^^^^^^^^^^^ AIR303 -207 | +207 | 208 | # apache-airflow-providers-daskexecutor | = help: Install `apache-airflow-provider-common-sql>=1.1.0` and use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator` instead. @@ -463,7 +462,7 @@ AIR303.py:209:1: AIR303 `airflow.executors.dask_executor.DaskExecutor` is moved 208 | # apache-airflow-providers-daskexecutor 209 | DaskExecutor() | ^^^^^^^^^^^^ AIR303 -210 | +210 | 211 | # apache-airflow-providers-docker | = help: Install `apache-airflow-provider-daskexecutor>=1.0.0` and use `airflow.providers.daskexecutor.executors.dask_executor.DaskExecutor` instead. @@ -483,7 +482,7 @@ AIR303.py:213:1: AIR303 `airflow.operators.docker_operator.DockerOperator` is mo 212 | DockerHook() 213 | DockerOperator() | ^^^^^^^^^^^^^^ AIR303 -214 | +214 | 215 | # apache-airflow-providers-apache-druid | = help: Install `apache-airflow-provider-docker>=1.0.0` and use `airflow.providers.docker.operators.docker.DockerOperator` instead. @@ -514,7 +513,7 @@ AIR303.py:218:1: AIR303 `airflow.operators.druid_check_operator.DruidCheckOperat 217 | DruidHook() 218 | DruidCheckOperator() | ^^^^^^^^^^^^^^^^^^ AIR303 -219 | +219 | 220 | # apache-airflow-providers-apache-hdfs | = help: Install `apache-airflow-provider-apache-druid>=1.0.0` and use `DruidCheckOperator` instead. @@ -534,7 +533,7 @@ AIR303.py:222:1: AIR303 `airflow.sensors.web_hdfs_sensor.WebHdfsSensor` is moved 221 | WebHDFSHook() 222 | WebHdfsSensor() | ^^^^^^^^^^^^^ AIR303 -223 | +223 | 224 | # apache-airflow-providers-apache-hive | = help: Install `apache-airflow-provider-apache-hdfs>=1.0.0` and use `airflow.providers.apache.hdfs.sensors.web_hdfs.WebHdfsSensor` instead. @@ -708,7 +707,7 @@ AIR303.py:240:1: AIR303 `airflow.sensors.named_hive_partition_sensor.NamedHivePa 239 | MetastorePartitionSensor() 240 | NamedHivePartitionSensor() | ^^^^^^^^^^^^^^^^^^^^^^^^ AIR303 -241 | +241 | 242 | # apache-airflow-providers-http | = help: Install `apache-airflow-provider-apache-hive>=1.0.0` and use `airflow.providers.apache.hive.sensors.named_hive_partition.NamedHivePartitionSensor` instead. @@ -739,7 +738,7 @@ AIR303.py:245:1: AIR303 `airflow.operators.http_operator.SimpleHttpOperator` is 244 | HttpSensor() 245 | SimpleHttpOperator() | ^^^^^^^^^^^^^^^^^^ AIR303 -246 | +246 | 247 | # apache-airflow-providers-jdbc | = help: Install `apache-airflow-provider-http>=1.0.0` and use `airflow.providers.http.operators.http.SimpleHttpOperator` instead. @@ -770,7 +769,7 @@ AIR303.py:250:1: AIR303 `airflow.operators.jdbc_operator.JdbcOperator` is moved 249 | JdbcHook() 250 | JdbcOperator() | ^^^^^^^^^^^^ AIR303 -251 | +251 | 252 | # apache-airflow-providers-fab | = help: Install `apache-airflow-provider-jdbc>=1.0.0` and use `airflow.providers.jdbc.operators.jdbc.JdbcOperator` instead. @@ -844,7 +843,7 @@ AIR303.py:258:1: AIR303 `airflow.www.security.FabAirflowSecurityManagerOverride` 257 | FabAuthManager() 258 | FabAirflowSecurityManagerOverride() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR303 -259 | +259 | 260 | # apache-airflow-providers-cncf-kubernetes | = help: Install `apache-airflow-provider-fab>=1.0.0` and use `airflow.providers.fab.auth_manager.security_manager.override.FabAirflowSecurityManagerOverride` instead. @@ -1062,7 +1061,7 @@ AIR303.py:280:1: AIR303 `airflow.kubernetes.secret.Secret` is moved into `cncf-k 279 | VolumeMount() 280 | Secret() | ^^^^^^ AIR303 -281 | +281 | 282 | add_pod_suffix() | = help: Install `apache-airflow-provider-cncf-kubernetes>=7.4.0` and use `airflow.providers.cncf.kubernetes.secret.Secret` instead. @@ -1070,7 +1069,7 @@ AIR303.py:280:1: AIR303 `airflow.kubernetes.secret.Secret` is moved into `cncf-k AIR303.py:282:1: AIR303 `airflow.kubernetes.kubernetes_helper_functions.add_pod_suffix` is moved into `cncf-kubernetes` provider in Airflow 3.0; | 280 | Secret() -281 | +281 | 282 | add_pod_suffix() | ^^^^^^^^^^^^^^ AIR303 283 | add_pod_suffix2() @@ -1298,7 +1297,7 @@ AIR303.py:307:1: AIR303 `airflow.operators.mssql_to_hive.MsSqlToHiveTransfer` is 306 | MsSqlToHiveOperator() 307 | MsSqlToHiveTransfer() | ^^^^^^^^^^^^^^^^^^^ AIR303 -308 | +308 | 309 | # apache-airflow-providers-mysql | = help: Install `apache-airflow-provider-apache-hive>=1.0.0` and use `airflow.providers.apache.hive.transfers.mssql_to_hive.MsSqlToHiveOperator` instead. @@ -1384,7 +1383,7 @@ AIR303.py:317:1: AIR303 `airflow.operators.presto_to_mysql.PrestoToMySqlTransfer 316 | PrestoToMySqlOperator() 317 | PrestoToMySqlTransfer() | ^^^^^^^^^^^^^^^^^^^^^ AIR303 -318 | +318 | 319 | # apache-airflow-providers-oracle | = help: Install `apache-airflow-provider-mysql>=1.0.0` and use `airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator` instead. @@ -1404,7 +1403,7 @@ AIR303.py:321:1: AIR303 `airflow.operators.oracle_operator.OracleOperator` is mo 320 | OracleHook() 321 | OracleOperator() | ^^^^^^^^^^^^^^ AIR303 -322 | +322 | 323 | # apache-airflow-providers-papermill | = help: Install `apache-airflow-provider-oracle>=1.0.0` and use `airflow.providers.oracle.operators.oracle.OracleOperator` instead. @@ -1414,7 +1413,7 @@ AIR303.py:324:1: AIR303 `airflow.operators.papermill_operator.PapermillOperator` 323 | # apache-airflow-providers-papermill 324 | PapermillOperator() | ^^^^^^^^^^^^^^^^^ AIR303 -325 | +325 | 326 | # apache-airflow-providers-apache-pig | = help: Install `apache-airflow-provider-papermill>=1.0.0` and use `airflow.providers.papermill.operators.papermill.PapermillOperator` instead. @@ -1434,7 +1433,7 @@ AIR303.py:328:1: AIR303 `airflow.operators.pig_operator.PigOperator` is moved in 327 | PigCliHook() 328 | PigOperator() | ^^^^^^^^^^^ AIR303 -329 | +329 | 330 | # apache-airflow-providers-postgres | = help: Install `apache-airflow-provider-apache-pig>=1.0.0` and use `airflow.providers.apache.pig.operators.pig.PigOperator` instead. @@ -1465,7 +1464,7 @@ AIR303.py:333:1: AIR303 `airflow.operators.postgres_operator.PostgresOperator` i 332 | PostgresHook() 333 | PostgresOperator() | ^^^^^^^^^^^^^^^^ AIR303 -334 | +334 | 335 | # apache-airflow-providers-presto | = help: Install `apache-airflow-provider-postgres>=1.0.0` and use `airflow.providers.postgres.operators.postgres.PostgresOperator` instead. @@ -1475,7 +1474,7 @@ AIR303.py:336:1: AIR303 `airflow.hooks.presto_hook.PrestoHook` is moved into `pr 335 | # apache-airflow-providers-presto 336 | PrestoHook() | ^^^^^^^^^^ AIR303 -337 | +337 | 338 | # apache-airflow-providers-samba | = help: Install `apache-airflow-provider-presto>=1.0.0` and use `airflow.providers.presto.hooks.presto.PrestoHook` instead. @@ -1485,7 +1484,7 @@ AIR303.py:339:1: AIR303 `airflow.hooks.samba_hook.SambaHook` is moved into `samb 338 | # apache-airflow-providers-samba 339 | SambaHook() | ^^^^^^^^^ AIR303 -340 | +340 | 341 | # apache-airflow-providers-slack | = help: Install `apache-airflow-provider-samba>=1.0.0` and use `airflow.providers.samba.hooks.samba.SambaHook` instead. @@ -1516,7 +1515,7 @@ AIR303.py:344:1: AIR303 `airflow.operators.slack_operator.SlackAPIPostOperator` 343 | SlackAPIOperator() 344 | SlackAPIPostOperator() | ^^^^^^^^^^^^^^^^^^^^ AIR303 -345 | +345 | 346 | # apache-airflow-providers-sqlite | = help: Install `apache-airflow-provider-slack>=1.0.0` and use `airflow.providers.slack.operators.slack.SlackAPIPostOperator` instead. @@ -1536,7 +1535,7 @@ AIR303.py:348:1: AIR303 `airflow.operators.sqlite_operator.SqliteOperator` is mo 347 | SqliteHook() 348 | SqliteOperator() | ^^^^^^^^^^^^^^ AIR303 -349 | +349 | 350 | # apache-airflow-providers-zendesk | = help: Install `apache-airflow-provider-sqlite>=1.0.0` and use `airflow.providers.sqlite.operators.sqlite.SqliteOperator` instead. 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 7c1f04b602..37331b9007 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/eradicate/mod.rs -snapshot_kind: text --- ERA001.py:1:1: ERA001 Found commented-out code | @@ -59,7 +58,7 @@ ERA001.py:5:1: ERA001 Found commented-out code 4 | a = 4 5 | #foo(1, 2, 3) | ^^^^^^^^^^^^^ ERA001 -6 | +6 | 7 | def foo(x, y, z): | = help: Remove commented-out code @@ -152,7 +151,7 @@ ERA001.py:27:5: ERA001 Found commented-out code ERA001.py:32:1: ERA001 Found commented-out code | 30 | #import os # noqa -31 | +31 | 32 | # case 1: | ^^^^^^^^^ ERA001 33 | # try: @@ -349,7 +348,7 @@ ERA001.py:78:1: ERA001 Found commented-out code 77 | # "rich", 78 | # ] | ^^^ ERA001 -79 | +79 | 80 | # Script tag block followed by normal block (Ok) | = help: Remove commented-out code diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap index e0db955426..bd81dd2410 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT101_YTT101.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info` | 4 | print(sys.version) -5 | +5 | 6 | print(sys.version[:3]) | ^^^^^^^^^^^ YTT101 7 | print(version[:3]) @@ -26,6 +25,6 @@ YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.versio 7 | print(version[:3]) 8 | print(v[:3]) | ^ YTT101 - 9 | + 9 | 10 | # the tool is timid and only flags certain numeric slices | diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap index c0eb5ebed5..b5b82d89fa 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT102_YTT102.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info` | 2 | from sys import version -3 | +3 | 4 | py_minor = sys.version[2] | ^^^^^^^^^^^ YTT102 5 | py_minor = version[2] diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap index ec2eff1b5a..fb884488c8 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT103_YTT103.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info` | 2 | from sys import version -3 | +3 | 4 | version < "3.5" | ^^^^^^^ YTT103 5 | sys.version < "3.5" diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap index 9278d8196b..c2ae9a2698 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT201_YTT201.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=` | 5 | PY3 = sys.version_info[0] >= 3 -6 | +6 | 7 | PY3 = sys.version_info[0] == 3 | ^^^^^^^^^^^^^^^^^^^ YTT201 8 | PY3 = version_info[0] == 3 diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap index 683a9711e1..da923c2649 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT202_YTT202.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2` | 2 | from six import PY3 -3 | +3 | 4 | if six.PY3: | ^^^^^^^ YTT202 5 | print("3") diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap index fa179afc0d..98340c2c0d 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT203_YTT203.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT203.py:4:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple | 2 | from sys import version_info -3 | +3 | 4 | sys.version_info[1] >= 5 | ^^^^^^^^^^^^^^^^^^^ YTT203 5 | version_info[1] < 6 diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap index 61b5b9c5d6..0d59be0063 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT204_YTT204.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT204.py:4:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple | 2 | from sys import version_info -3 | +3 | 4 | sys.version_info.minor <= 7 | ^^^^^^^^^^^^^^^^^^^^^^ YTT204 5 | version_info.minor > 8 diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap index 45a73e3d8e..df1b27d330 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT301_YTT301.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info` | 2 | from sys import version -3 | +3 | 4 | py_major = sys.version[0] | ^^^^^^^^^^^ YTT301 5 | py_major = version[0] diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap index 9eb476ff8f..27e563290e 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT302_YTT302.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info` | 2 | from sys import version -3 | +3 | 4 | version < "3" | ^^^^^^^ YTT302 5 | sys.version < "3" diff --git a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap index bc7af81ce5..8cda6c2108 100644 --- a/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap +++ b/crates/ruff_linter/src/rules/flake8_2020/snapshots/ruff_linter__rules__flake8_2020__tests__YTT303_YTT303.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_2020/mod.rs -snapshot_kind: text --- YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info` | 2 | from sys import version -3 | +3 | 4 | print(sys.version[:1]) | ^^^^^^^^^^^ YTT303 5 | print(version[:1]) diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap index c95591ac21..71e528ec5d 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs -snapshot_kind: text --- ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for public function `error_partially_typed_1` | @@ -55,7 +54,7 @@ ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for publ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for public function `error_typed_self` | 41 | pass -42 | +42 | 43 | def error_typed_self(self: X): | ^^^^^^^^^^^^^^^^ ANN201 44 | pass 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 2b0d08f1fd..bc8e91807b 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs -snapshot_kind: text --- simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__` | @@ -22,7 +21,7 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__` | 3 | ... -4 | +4 | 5 | def __repr__(self): | ^^^^^^^^ ANN204 6 | ... @@ -42,7 +41,7 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__` | 6 | ... -7 | +7 | 8 | def __len__(self): | ^^^^^^^ ANN204 9 | ... @@ -62,7 +61,7 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__` | 9 | ... -10 | +10 | 11 | def __length_hint__(self): | ^^^^^^^^^^^^^^^ ANN204 12 | ... @@ -82,7 +81,7 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__` | 12 | ... -13 | +13 | 14 | def __init__(self): | ^^^^^^^^ ANN204 15 | ... @@ -102,7 +101,7 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__` | 15 | ... -16 | +16 | 17 | def __del__(self): | ^^^^^^^ ANN204 18 | ... @@ -122,7 +121,7 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__` | 18 | ... -19 | +19 | 20 | def __bool__(self): | ^^^^^^^^ ANN204 21 | ... @@ -142,7 +141,7 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__` | 21 | ... -22 | +22 | 23 | def __bytes__(self): | ^^^^^^^^^ ANN204 24 | ... @@ -162,7 +161,7 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__` | 24 | ... -25 | +25 | 26 | def __format__(self, format_spec): | ^^^^^^^^^^ ANN204 27 | ... @@ -182,7 +181,7 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__` | 27 | ... -28 | +28 | 29 | def __contains__(self, item): | ^^^^^^^^^^^^ ANN204 30 | ... @@ -202,7 +201,7 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__` | 30 | ... -31 | +31 | 32 | def __complex__(self): | ^^^^^^^^^^^ ANN204 33 | ... @@ -222,7 +221,7 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__` | 33 | ... -34 | +34 | 35 | def __int__(self): | ^^^^^^^ ANN204 36 | ... @@ -242,7 +241,7 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__` | 36 | ... -37 | +37 | 38 | def __float__(self): | ^^^^^^^^^ ANN204 39 | ... @@ -262,7 +261,7 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__` | 39 | ... -40 | +40 | 41 | def __index__(self): | ^^^^^^^^^ ANN204 42 | ... diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap index aa8fbdfacf..13b59fdecc 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediately awaited | @@ -468,7 +467,7 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme 52 | trio.lowlevel.wait_task_rescheduled(foo) 53 | trio.lowlevel.wait_writable(foo) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC105 -54 | +54 | 55 | async with await trio.open_file(foo): # Ok | = help: Add `await` @@ -486,7 +485,7 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited | 56 | pass -57 | +57 | 58 | async with trio.open_file(foo): # ASYNC105 | ^^^^^^^^^^^^^^^^^^^ ASYNC105 59 | pass diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap index c74f845ec5..ab2185ba56 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 3 | from trio import sleep -4 | +4 | 5 | await trio.sleep(0) # ASYNC115 | ^^^^^^^^^^^^^ ASYNC115 6 | await trio.sleep(1) # OK @@ -26,7 +25,7 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 9 | await trio.sleep() # OK -10 | +10 | 11 | trio.sleep(0) # ASYNC115 | ^^^^^^^^^^^^^ ASYNC115 12 | foo = 0 @@ -47,10 +46,10 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 15 | time.sleep(0) # OK -16 | +16 | 17 | sleep(0) # ASYNC115 | ^^^^^^^^ ASYNC115 -18 | +18 | 19 | bar = "bar" | = help: Replace with `trio.lowlevel.checkpoint()` @@ -68,7 +67,7 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 46 | import trio -47 | +47 | 48 | trio.run(trio.sleep(0)) # ASYNC115 | ^^^^^^^^^^^^^ ASYNC115 | @@ -137,7 +136,7 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 83 | from anyio import sleep -84 | +84 | 85 | await anyio.sleep(0) # ASYNC115 | ^^^^^^^^^^^^^^ ASYNC115 86 | await anyio.sleep(1) # OK @@ -166,7 +165,7 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of ` ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 89 | await anyio.sleep() # OK -90 | +90 | 91 | anyio.sleep(0) # ASYNC115 | ^^^^^^^^^^^^^^ ASYNC115 92 | foo = 0 @@ -195,10 +194,10 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 95 | time.sleep(0) # OK -96 | +96 | 97 | sleep(0) # ASYNC115 | ^^^^^^^^ ASYNC115 -98 | +98 | 99 | bar = "bar" | = help: Replace with `asyncio.lowlevel.checkpoint()` @@ -224,7 +223,7 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 126 | import anyio -127 | +127 | 128 | anyio.run(anyio.sleep(0)) # ASYNC115 | ^^^^^^^^^^^^^^ ASYNC115 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap index 1de308a83e..c068004685 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 10 | # These examples are probably not meant to ever wake up: 11 | await trio.sleep(100000) # error: 116, "async" | ^^^^^^^^^^^^^^^^^^ ASYNC116 -12 | +12 | 13 | # 'inf literal' overflow trick | = help: Replace with `trio.sleep_forever()` @@ -27,7 +26,7 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 13 | # 'inf literal' overflow trick 14 | await trio.sleep(1e999) # error: 116, "async" | ^^^^^^^^^^^^^^^^^ ASYNC116 -15 | +15 | 16 | await trio.sleep(86399) | = help: Replace with `trio.sleep_forever()` @@ -68,7 +67,7 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 18 | await trio.sleep(86400.01) # error: 116, "async" 19 | await trio.sleep(86401) # error: 116, "async" | ^^^^^^^^^^^^^^^^^ ASYNC116 -20 | +20 | 21 | await trio.sleep(-1) # will raise a runtime error | = help: Replace with `trio.sleep_forever()` @@ -153,7 +152,7 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 63 | # These examples are probably not meant to ever wake up: 64 | await anyio.sleep(100000) # error: 116, "async" | ^^^^^^^^^^^^^^^^^^^ ASYNC116 -65 | +65 | 66 | # 'inf literal' overflow trick | = help: Replace with `asyncio.sleep_forever()` @@ -181,7 +180,7 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 66 | # 'inf literal' overflow trick 67 | await anyio.sleep(1e999) # error: 116, "async" | ^^^^^^^^^^^^^^^^^^ ASYNC116 -68 | +68 | 69 | await anyio.sleep(86399) | = help: Replace with `asyncio.sleep_forever()` @@ -238,7 +237,7 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 71 | await anyio.sleep(86400.01) # error: 116, "async" 72 | await anyio.sleep(86401) # error: 116, "async" | ^^^^^^^^^^^^^^^^^^ ASYNC116 -73 | +73 | 74 | await anyio.sleep(-1) # will raise a runtime error | = help: Replace with `asyncio.sleep_forever()` diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap index 965aedd915..3b05d9961d 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC210_ASYNC210.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC210.py:8:5: ASYNC210 Async functions should not call blocking HTTP methods | @@ -71,7 +70,7 @@ ASYNC210.py:32:11: ASYNC210 Async functions should not call blocking HTTP method 31 | print(requests.get()) # ASYNC210 32 | print(requests.get(requests.get())) # ASYNC210 | ^^^^^^^^^^^^ ASYNC210 -33 | +33 | 34 | requests.options() # ASYNC210 | @@ -81,14 +80,14 @@ ASYNC210.py:32:24: ASYNC210 Async functions should not call blocking HTTP method 31 | print(requests.get()) # ASYNC210 32 | print(requests.get(requests.get())) # ASYNC210 | ^^^^^^^^^^^^ ASYNC210 -33 | +33 | 34 | requests.options() # ASYNC210 | ASYNC210.py:34:5: ASYNC210 Async functions should not call blocking HTTP methods | 32 | print(requests.get(requests.get())) # ASYNC210 -33 | +33 | 34 | requests.options() # ASYNC210 | ^^^^^^^^^^^^^^^^ ASYNC210 35 | requests.head() # ASYNC210 @@ -146,7 +145,7 @@ ASYNC210.py:39:5: ASYNC210 Async functions should not call blocking HTTP methods ASYNC210.py:42:5: ASYNC210 Async functions should not call blocking HTTP methods | 40 | requests.foo() -41 | +41 | 42 | httpx.options("") # ASYNC210 | ^^^^^^^^^^^^^ ASYNC210 43 | httpx.head("") # ASYNC210 @@ -204,7 +203,7 @@ ASYNC210.py:47:5: ASYNC210 Async functions should not call blocking HTTP methods ASYNC210.py:50:5: ASYNC210 Async functions should not call blocking HTTP methods | 48 | httpx.foo() # Ok -49 | +49 | 50 | urllib3.request() # ASYNC210 | ^^^^^^^^^^^^^^^ ASYNC210 51 | urllib3.request(...) # ASYNC210 @@ -215,16 +214,16 @@ ASYNC210.py:51:5: ASYNC210 Async functions should not call blocking HTTP methods 50 | urllib3.request() # ASYNC210 51 | urllib3.request(...) # ASYNC210 | ^^^^^^^^^^^^^^^ ASYNC210 -52 | +52 | 53 | urllib.request.urlopen("") # ASYNC210 | ASYNC210.py:53:5: ASYNC210 Async functions should not call blocking HTTP methods | 51 | urllib3.request(...) # ASYNC210 -52 | +52 | 53 | urllib.request.urlopen("") # ASYNC210 | ^^^^^^^^^^^^^^^^^^^^^^ ASYNC210 -54 | +54 | 55 | r = {} | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap index 89188ba179..6be0e845ea 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC220_ASYNC22x.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC22x.py:31:5: ASYNC220 Async functions should not create subprocesses with blocking methods | @@ -45,7 +44,7 @@ ASYNC22x.py:76:5: ASYNC220 Async functions should not create subprocesses with b 75 | os.spawnl(mode=os.P_NOWAIT) # ASYNC220 76 | os.spawnl(mode=P_NOWAIT) # ASYNC220 | ^^^^^^^^^ ASYNC220 -77 | +77 | 78 | P_WAIT = os.P_WAIT | @@ -73,6 +72,6 @@ ASYNC22x.py:88:5: ASYNC220 Async functions should not create subprocesses with b 87 | os.spawnl(1) # ASYNC220 88 | os.spawnl(foo()) # ASYNC220 | ^^^^^^^^^ ASYNC220 -89 | +89 | 90 | # ASYNC222 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap index 889ed049ad..b838d96026 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC221_ASYNC22x.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC22x.py:8:5: ASYNC221 Async functions should not run processes with blocking methods | @@ -32,14 +31,14 @@ ASYNC22x.py:32:5: ASYNC221 Async functions should not run processes with blockin 31 | subprocess.Popen() # ASYNC220 32 | os.system() # ASYNC221 | ^^^^^^^^^ ASYNC221 -33 | +33 | 34 | system() | ASYNC22x.py:38:5: ASYNC221 Async functions should not run processes with blocking methods | 36 | os.anything() -37 | +37 | 38 | subprocess.run() # ASYNC221 | ^^^^^^^^^^^^^^ ASYNC221 39 | subprocess.call() # ASYNC221 @@ -90,7 +89,7 @@ ASYNC22x.py:43:5: ASYNC221 Async functions should not run processes with blockin 42 | subprocess.getoutput() # ASYNC221 43 | subprocess.getstatusoutput() # ASYNC221 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ASYNC221 -44 | +44 | 45 | await async_fun( | @@ -105,7 +104,7 @@ ASYNC22x.py:46:9: ASYNC221 Async functions should not run processes with blockin ASYNC22x.py:54:5: ASYNC221 Async functions should not run processes with blocking methods | 52 | subprocess() -53 | +53 | 54 | os.posix_spawn() # ASYNC221 | ^^^^^^^^^^^^^^ ASYNC221 55 | os.posix_spawnp() # ASYNC221 @@ -116,14 +115,14 @@ ASYNC22x.py:55:5: ASYNC221 Async functions should not run processes with blockin 54 | os.posix_spawn() # ASYNC221 55 | os.posix_spawnp() # ASYNC221 | ^^^^^^^^^^^^^^^ ASYNC221 -56 | +56 | 57 | os.spawn() | ASYNC22x.py:61:5: ASYNC221 Async functions should not run processes with blocking methods | 59 | os.spawnllll() -60 | +60 | 61 | os.spawnl() # ASYNC221 | ^^^^^^^^^ ASYNC221 62 | os.spawnle() # ASYNC221 @@ -194,7 +193,7 @@ ASYNC22x.py:68:5: ASYNC221 Async functions should not run processes with blockin 67 | os.spawnvp() # ASYNC221 68 | os.spawnvpe() # ASYNC221 | ^^^^^^^^^^^ ASYNC221 -69 | +69 | 70 | P_NOWAIT = os.P_NOWAIT | @@ -222,6 +221,6 @@ ASYNC22x.py:83:5: ASYNC221 Async functions should not run processes with blockin 82 | os.spawnl(mode=os.P_WAIT) # ASYNC221 83 | os.spawnl(mode=P_WAIT) # ASYNC221 | ^^^^^^^^^ ASYNC221 -84 | +84 | 85 | # other weird cases: ASYNC220 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap index 2e89bc3008..66ca87ebfe 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC222_ASYNC22x.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC22x.py:20:5: ASYNC222 Async functions should not wait on processes with blocking methods | @@ -60,6 +59,6 @@ ASYNC22x.py:95:5: ASYNC222 Async functions should not wait on processes with blo 94 | os.waitid() # ASYNC222 95 | os.waitpid() # ASYNC222 | ^^^^^^^^^^ ASYNC222 -96 | +96 | 97 | os.waitpi() | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap index f488a34af7..b842175406 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC230_ASYNC230.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_async/mod.rs -snapshot_kind: text --- ASYNC230.py:6:5: ASYNC230 Async functions should not open files with blocking methods like `open` | @@ -16,14 +15,14 @@ ASYNC230.py:7:5: ASYNC230 Async functions should not open files with blocking me 6 | open("") # ASYNC230 7 | io.open_code("") # ASYNC230 | ^^^^^^^^^^^^ ASYNC230 -8 | +8 | 9 | with open(""): # ASYNC230 | ASYNC230.py:9:10: ASYNC230 Async functions should not open files with blocking methods like `open` | 7 | io.open_code("") # ASYNC230 - 8 | + 8 | 9 | with open(""): # ASYNC230 | ^^^^ ASYNC230 10 | ... @@ -32,7 +31,7 @@ ASYNC230.py:9:10: ASYNC230 Async functions should not open files with blocking m ASYNC230.py:12:10: ASYNC230 Async functions should not open files with blocking methods like `open` | 10 | ... -11 | +11 | 12 | with open("") as f: # ASYNC230 | ^^^^ ASYNC230 13 | ... @@ -41,7 +40,7 @@ ASYNC230.py:12:10: ASYNC230 Async functions should not open files with blocking ASYNC230.py:15:17: ASYNC230 Async functions should not open files with blocking methods like `open` | 13 | ... -14 | +14 | 15 | with foo(), open(""): # ASYNC230 | ^^^^ ASYNC230 16 | ... @@ -50,7 +49,7 @@ ASYNC230.py:15:17: ASYNC230 Async functions should not open files with blocking ASYNC230.py:18:16: ASYNC230 Async functions should not open files with blocking methods like `open` | 16 | ... -17 | +17 | 18 | async with open(""): # ASYNC230 | ^^^^ ASYNC230 19 | ... @@ -96,7 +95,7 @@ ASYNC230.py:53:9: ASYNC230 Async functions should not open files with blocking m ASYNC230.py:59:5: ASYNC230 Async functions should not open files with blocking methods like `open` | 57 | (p1, p2) = (Path("foo"), Path("bar")) -58 | +58 | 59 | p1.open() # ASYNC230 | ^^^^^^^ ASYNC230 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap index 1ef4bb202c..317ef1d7f4 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S102_S102.py.snap @@ -7,14 +7,14 @@ S102.py:3:5: S102 Use of `exec` detected 2 | # Error 3 | exec('x = 2') | ^^^^ S102 -4 | +4 | 5 | exec('y = 3') | S102.py:5:1: S102 Use of `exec` detected | 3 | exec('x = 2') -4 | +4 | 5 | exec('y = 3') | ^^^^ S102 | @@ -25,6 +25,6 @@ S102.py:11:5: S102 Use of `exec` detected 10 | from builtins import exec 11 | exec('') # Error | ^^^^ S102 -12 | +12 | 13 | def _(): | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap index 96bebf6074..f400e65f28 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S103_S103.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory | 4 | keyfile = "foo" -5 | +5 | 6 | os.chmod("/etc/passwd", 0o227) # Error | ^^^^^ S103 7 | os.chmod("/etc/passwd", 0o7) # Error diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap index 34ba1ff63c..851cb57409 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S105_S105.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S105.py:13:12: S105 Possible hardcoded password assigned to: "password" | @@ -126,14 +125,14 @@ S105.py:25:19: S105 Possible hardcoded password assigned to: "password" 24 | password: str = "s3cr3t" 25 | password: Final = "s3cr3t" | ^^^^^^^^ S105 -26 | +26 | 27 | d["password"] = "s3cr3t" | S105.py:27:17: S105 Possible hardcoded password assigned to: "password" | 25 | password: Final = "s3cr3t" -26 | +26 | 27 | d["password"] = "s3cr3t" | ^^^^^^^^ S105 28 | d["pass"] = "s3cr3t" @@ -286,14 +285,14 @@ S105.py:49:19: S105 Possible hardcoded password assigned to: "secrete" 48 | MyClass.token = "s3cr3t" 49 | MyClass.secrete = "s3cr3t" | ^^^^^^^^ S105 -50 | +50 | 51 | password == "s3cr3t" | S105.py:51:13: S105 Possible hardcoded password assigned to: "password" | 49 | MyClass.secrete = "s3cr3t" -50 | +50 | 51 | password == "s3cr3t" | ^^^^^^^^ S105 52 | _pass == "s3cr3t" @@ -364,14 +363,14 @@ S105.py:58:21: S105 Possible hardcoded password assigned to: "password" 57 | secrete == "s3cr3t" 58 | password == safe == "s3cr3t" | ^^^^^^^^ S105 -59 | +59 | 60 | if token == "1\n2": | S105.py:60:13: S105 Possible hardcoded password assigned to: "token" | 58 | password == safe == "s3cr3t" -59 | +59 | 60 | if token == "1\n2": | ^^^^^^ S105 61 | pass @@ -380,7 +379,7 @@ S105.py:60:13: S105 Possible hardcoded password assigned to: "token" S105.py:63:13: S105 Possible hardcoded password assigned to: "token" | 61 | pass -62 | +62 | 63 | if token == "3\t4": | ^^^^^^ S105 64 | pass @@ -389,7 +388,7 @@ S105.py:63:13: S105 Possible hardcoded password assigned to: "token" S105.py:66:13: S105 Possible hardcoded password assigned to: "token" | 64 | pass -65 | +65 | 66 | if token == "5\r6": | ^^^^^^ S105 67 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap index 93500e05ce..2b601edf61 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_S108.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 3 | f.write("def") -4 | +4 | 5 | with open("/tmp/abc", "w") as f: | ^^^^^^^^^^ S108 6 | f.write("def") @@ -14,7 +13,7 @@ S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp S108.py:8:13: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 6 | f.write("def") -7 | +7 | 8 | with open(f"/tmp/abc", "w") as f: | ^^^^^^^^ S108 9 | f.write("def") @@ -23,7 +22,7 @@ S108.py:8:13: S108 Probable insecure usage of temporary file or directory: "/tmp S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123" | 9 | f.write("def") -10 | +10 | 11 | with open("/var/tmp/123", "w") as f: | ^^^^^^^^^^^^^^ S108 12 | f.write("def") @@ -32,7 +31,7 @@ S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/va S108.py:14:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test" | 12 | f.write("def") -13 | +13 | 14 | with open("/dev/shm/unit/test", "w") as f: | ^^^^^^^^^^^^^^^^^^^^ S108 15 | f.write("def") @@ -49,7 +48,7 @@ S108.py:22:11: S108 Probable insecure usage of temporary file or directory: "/tm S108.py:25:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 23 | f.write("def") -24 | +24 | 25 | with open("/tmp/abc" f"/tmp/abc", "w") as f: | ^^^^^^^^^^ S108 26 | f.write("def") @@ -58,7 +57,7 @@ S108.py:25:11: S108 Probable insecure usage of temporary file or directory: "/tm S108.py:25:24: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 23 | f.write("def") -24 | +24 | 25 | with open("/tmp/abc" f"/tmp/abc", "w") as f: | ^^^^^^^^ S108 26 | f.write("def") diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap index 90caacf9dd..bcaf957a3d 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S108_extend.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 3 | f.write("def") -4 | +4 | 5 | with open("/tmp/abc", "w") as f: | ^^^^^^^^^^ S108 6 | f.write("def") @@ -14,7 +13,7 @@ S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp S108.py:8:13: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 6 | f.write("def") -7 | +7 | 8 | with open(f"/tmp/abc", "w") as f: | ^^^^^^^^ S108 9 | f.write("def") @@ -23,7 +22,7 @@ S108.py:8:13: S108 Probable insecure usage of temporary file or directory: "/tmp S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/var/tmp/123" | 9 | f.write("def") -10 | +10 | 11 | with open("/var/tmp/123", "w") as f: | ^^^^^^^^^^^^^^ S108 12 | f.write("def") @@ -32,7 +31,7 @@ S108.py:11:11: S108 Probable insecure usage of temporary file or directory: "/va S108.py:14:11: S108 Probable insecure usage of temporary file or directory: "/dev/shm/unit/test" | 12 | f.write("def") -13 | +13 | 14 | with open("/dev/shm/unit/test", "w") as f: | ^^^^^^^^^^^^^^^^^^^^ S108 15 | f.write("def") @@ -57,7 +56,7 @@ S108.py:22:11: S108 Probable insecure usage of temporary file or directory: "/tm S108.py:25:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 23 | f.write("def") -24 | +24 | 25 | with open("/tmp/abc" f"/tmp/abc", "w") as f: | ^^^^^^^^^^ S108 26 | f.write("def") @@ -66,7 +65,7 @@ S108.py:25:11: S108 Probable insecure usage of temporary file or directory: "/tm S108.py:25:24: S108 Probable insecure usage of temporary file or directory: "/tmp/abc" | 23 | f.write("def") -24 | +24 | 25 | with open("/tmp/abc" f"/tmp/abc", "w") as f: | ^^^^^^^^ S108 26 | f.write("def") diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap index f8482165d5..ecf235771f 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_S110.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception | @@ -9,7 +8,7 @@ S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception 3 | / except Exception: 4 | | pass | |________^ S110 -5 | +5 | 6 | try: | @@ -20,6 +19,6 @@ S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception 8 | / except: 9 | | pass | |________^ S110 -10 | +10 | 11 | try: | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap index ed8c875ee4..a0971f71ad 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S110_typed.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception | @@ -9,7 +8,7 @@ S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception 3 | / except Exception: 4 | | pass | |________^ S110 -5 | +5 | 6 | try: | @@ -20,7 +19,7 @@ S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception 8 | / except: 9 | | pass | |________^ S110 -10 | +10 | 11 | try: | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap index e7e2cfd249..2df863f5fd 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S112_S112.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the exception | @@ -9,7 +8,7 @@ S112.py:3:1: S112 `try`-`except`-`continue` detected, consider logging the excep 3 | / except Exception: 4 | | continue | |____________^ S112 -5 | +5 | 6 | try: | @@ -20,7 +19,7 @@ S112.py:8:1: S112 `try`-`except`-`continue` detected, consider logging the excep 8 | / except: 9 | | continue | |____________^ S112 -10 | +10 | 11 | try: | @@ -31,7 +30,7 @@ S112.py:13:1: S112 `try`-`except`-`continue` detected, consider logging the exce 13 | / except (Exception,): 14 | | continue | |____________^ S112 -15 | +15 | 16 | try: | @@ -42,6 +41,6 @@ S112.py:18:1: S112 `try`-`except`-`continue` detected, consider logging the exce 18 | / except (Exception, ValueError): 19 | | continue | |____________^ S112 -20 | +20 | 21 | try: | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap index 9d306eb589..9ae00a6a68 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S113_S113.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S113.py:46:1: S113 Probable use of `requests` call without timeout | @@ -136,14 +135,14 @@ S113.py:59:36: S113 Probable use of `requests` call with timeout set to `None` 58 | requests.head('https://gmail.com') 59 | requests.head('https://gmail.com', timeout=None) | ^^^^^^^^^^^^ S113 -60 | +60 | 61 | httpx.get('https://gmail.com', timeout=None) | S113.py:61:32: S113 Probable use of `httpx` call with timeout set to `None` | 59 | requests.head('https://gmail.com', timeout=None) -60 | +60 | 61 | httpx.get('https://gmail.com', timeout=None) | ^^^^^^^^^^^^ S113 62 | httpx.post('https://gmail.com', timeout=None) @@ -224,14 +223,14 @@ S113.py:69:19: S113 Probable use of `httpx` call with timeout set to `None` 68 | httpx.Client(timeout=None) 69 | httpx.AsyncClient(timeout=None) | ^^^^^^^^^^^^ S113 -70 | +70 | 71 | with httpx.Client(timeout=None) as client: | S113.py:71:19: S113 Probable use of `httpx` call with timeout set to `None` | 69 | httpx.AsyncClient(timeout=None) -70 | +70 | 71 | with httpx.Client(timeout=None) as client: | ^^^^^^^^^^^^ S113 72 | client.get('https://gmail.com') diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap index 3482b52cc4..11115cc0ba 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S201_S201.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S201.py:10:9: S201 Use of `debug=True` in Flask app detected | 9 | # OK 10 | app.run(debug=True) | ^^^^^^^^^^ S201 -11 | +11 | 12 | # Errors | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap index a383b44466..4e27b0d75b 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S301_S301.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S301.py:3:1: S301 `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue | 1 | import pickle -2 | +2 | 3 | pickle.loads() | ^^^^^^^^^^^^^^ S301 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap index eabf6067a2..7d474f3d31 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S307_S307.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S307.py:3:7: S307 Use of possibly insecure function; consider using `ast.literal_eval` | 1 | import os -2 | +2 | 3 | print(eval("1+1")) # S307 | ^^^^^^^^^^^ S307 4 | print(eval("os.getcwd()")) # S307 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap index 53f2927379..1a90de58fa 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S310.py:6:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | @@ -37,7 +36,7 @@ S310.py:11:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` 10 | urllib.request.urlopen('file:///foo/bar/baz') 11 | urllib.request.urlopen(url) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 -12 | +12 | 13 | urllib.request.Request(url='http://www.google.com') | @@ -76,14 +75,14 @@ S310.py:21:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` 20 | urllib.request.Request('file:///foo/bar/baz') 21 | urllib.request.Request(url) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 -22 | +22 | 23 | urllib.request.URLopener().open(fullurl='http://www.google.com') | S310.py:23:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | 21 | urllib.request.Request(url) -22 | +22 | 23 | urllib.request.URLopener().open(fullurl='http://www.google.com') | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 24 | urllib.request.URLopener().open(fullurl=f'http://www.google.com') @@ -174,7 +173,7 @@ S310.py:32:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` 31 | urllib.request.URLopener().open('file:///foo/bar/baz') 32 | urllib.request.URLopener().open(url) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 -33 | +33 | 34 | urllib.request.urlopen(url=urllib.request.Request('http://www.google.com')) | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap index ac73f2f77e..858f04e4a3 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S311.py:10:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | @@ -86,6 +85,6 @@ S311.py:18:1: S311 Standard pseudo-random generators are not suitable for crypto 17 | random.triangular() 18 | random.randbytes() | ^^^^^^^^^^^^^^^^^^ S311 -19 | +19 | 20 | # Unrelated | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap index 4c507202c6..1a4e25fbc6 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S312_S312.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S312.py:3:1: S312 Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol. | 1 | from telnetlib import Telnet -2 | +2 | 3 | Telnet("localhost", 23) | ^^^^^^^^^^^^^^^^^^^^^^^ S312 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap index 10318779d9..c1961029c7 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S324_S324.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S324.py:7:13: S324 Probable use of insecure hash functions in `hashlib`: `md5` | @@ -127,14 +126,14 @@ S324.py:20:13: S324 Probable use of insecure hash functions in `hashlib`: `sha1` 19 | # usedforsecurity arg only available in Python 3.9+ 20 | hashlib.new('sha1', usedforsecurity=True) | ^^^^^^ S324 -21 | +21 | 22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT) | S324.py:22:26: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT` | 20 | hashlib.new('sha1', usedforsecurity=True) -21 | +21 | 22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT) | ^^^^^^^^^^^^^^^^^^ S324 23 | crypt.crypt("test", salt=crypt.METHOD_MD5) @@ -165,14 +164,14 @@ S324.py:25:21: S324 Probable use of insecure hash functions in `crypt`: `crypt.M 24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH) 25 | crypt.crypt("test", crypt.METHOD_BLOWFISH) | ^^^^^^^^^^^^^^^^^^^^^ S324 -26 | +26 | 27 | crypt.mksalt(crypt.METHOD_CRYPT) | S324.py:27:14: S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT` | 25 | crypt.crypt("test", crypt.METHOD_BLOWFISH) -26 | +26 | 27 | crypt.mksalt(crypt.METHOD_CRYPT) | ^^^^^^^^^^^^^^^^^^ S324 28 | crypt.mksalt(crypt.METHOD_MD5) @@ -193,6 +192,6 @@ S324.py:29:14: S324 Probable use of insecure hash functions in `crypt`: `crypt.M 28 | crypt.mksalt(crypt.METHOD_MD5) 29 | crypt.mksalt(crypt.METHOD_BLOWFISH) | ^^^^^^^^^^^^^^^^^^^^^ S324 -30 | +30 | 31 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap index b8f363532c..5c2e46e3d1 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S501_S501.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S501.py:5:47: S501 Probable use of `requests` call with `verify=False` disabling SSL certificate checks | @@ -67,7 +66,7 @@ S501.py:17:48: S501 Probable use of `requests` call with `verify=False` disablin 16 | requests.head('https://gmail.com', timeout=30, verify=True) 17 | requests.head('https://gmail.com', timeout=30, verify=False) | ^^^^^^^^^^^^ S501 -18 | +18 | 19 | httpx.request('GET', 'https://gmail.com', verify=True) | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap index 3aa34a91df..4087d85ab4 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S502_S502.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S502.py:6:13: S502 Call made with insecure SSL protocol: `PROTOCOL_SSLv3` | 4 | from OpenSSL.SSL import Context -5 | +5 | 6 | wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3) # S502 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S502 7 | ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1) # S502 @@ -66,6 +65,6 @@ S502.py:12:9: S502 Call made with insecure SSL protocol: `TLSv1_METHOD` 11 | Context(method=SSL.SSLv3_METHOD) # S502 12 | Context(method=SSL.TLSv1_METHOD) # S502 | ^^^^^^^^^^^^^^^^^^^^^^^ S502 -13 | +13 | 14 | wrap_socket(ssl_version=ssl.PROTOCOL_TLS_CLIENT) # OK | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap index 023976280e..faf1b6729a 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S504_S504.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S504.py:4:1: S504 `ssl.wrap_socket` called without an `ssl_version`` | 2 | from ssl import wrap_socket -3 | +3 | 4 | ssl.wrap_socket() # S504 | ^^^^^^^^^^^^^^^^^ S504 5 | wrap_socket() # S504 diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap index 6b44dd23df..0177c4b1e4 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S505_S505.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S505.py:29:35: S505 DSA key sizes below 2048 bits are considered breakable | @@ -136,6 +135,6 @@ S505.py:44:28: S505 DSA key sizes below 2048 bits are considered breakable 43 | pycryptodomex_dsa.generate(2047) 44 | pycryptodomex_rsa.generate(2047) | ^^^^ S505 -45 | +45 | 46 | # Don't crash when the size is variable. | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap index 6d49ef426a..e20574f581 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S506_S506.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S506.py:10:9: S506 Probable use of unsafe `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`. | @@ -16,6 +15,6 @@ S506.py:24:24: S506 Probable use of unsafe loader `Loader` with `yaml.load`. All | 24 | yaml.load("{}", Loader=yaml.Loader) | ^^^^^^^^^^^ S506 -25 | +25 | 26 | # no issue should be found | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap index 791419044d..0cf6adf522 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S507_S507.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S507.py:15:40: S507 Paramiko call with policy set to automatically trust the unknown host key | @@ -76,6 +75,6 @@ S507.py:22:54: S507 Paramiko call with policy set to automatically trust the unk 21 | ssh_client.set_missing_host_key_policy(policy=WarningPolicy) 22 | ssh_client_from_paramiko.set_missing_host_key_policy(paramiko.AutoAddPolicy) | ^^^^^^^^^^^^^^^^^^^^^^ S507 -23 | +23 | 24 | # Unrelated | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap index f6d764b5ac..34e169f486 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S508_S508.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S508.py:3:25: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. | 1 | from pysnmp.hlapi import CommunityData -2 | +2 | 3 | CommunityData("public", mpModel=0) # S508 | ^^^^^^^^^ S508 4 | CommunityData("public", mpModel=1) # S508 @@ -16,6 +15,6 @@ S508.py:4:25: S508 The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. 3 | CommunityData("public", mpModel=0) # S508 4 | CommunityData("public", mpModel=1) # S508 | ^^^^^^^^^ S508 -5 | +5 | 6 | CommunityData("public", mpModel=2) # OK | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap index 86a0e40c67..f676630f91 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S509_S509.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S509.py:4:12: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure. | @@ -14,6 +13,6 @@ S509.py:5:16: S509 You should not use SNMPv3 without encryption. `noAuthNoPriv` 4 | insecure = UsmUserData("securityName") # S509 5 | auth_no_priv = UsmUserData("securityName", "authName") # S509 | ^^^^^^^^^^^ S509 -6 | +6 | 7 | less_insecure = UsmUserData("securityName", "authName", "privName") # OK | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap index 411dbef599..3479fa2b9e 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S601_S601.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S601.py:3:1: S601 Possible shell injection via Paramiko call; check inputs are properly sanitized | 1 | import paramiko -2 | +2 | 3 | paramiko.exec_command('something; really; unsafe') | ^^^^^^^^^^^^^^^^^^^^^ S601 | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap index b915b02143..54f3baf9f8 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S602_S602.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S602.py:4:1: S602 `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell` | @@ -46,7 +45,7 @@ S602.py:8:1: S602 `subprocess` call with `shell=True` seems safe, but may be cha 7 | check_output("true", shell=True) 8 | run("true", shell=True) | ^^^ S602 - 9 | + 9 | 10 | # Check values that truthy values are treated as true. | @@ -84,7 +83,7 @@ S602.py:14:1: S602 `subprocess` call with truthy `shell` seems safe, but may be 13 | Popen("true", shell={1: 1}) 14 | Popen("true", shell=(1,)) | ^^^^^ S602 -15 | +15 | 16 | # Check command argument looks unsafe. | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap index 12a354c8a4..dba0c93174 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S603_S603.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S603.py:4:1: S603 `subprocess` call: check for execution of untrusted input | @@ -46,7 +45,7 @@ S603.py:8:1: S603 `subprocess` call: check for execution of untrusted input 7 | check_output("true", shell=False) 8 | run("true", shell=False) | ^^^ S603 - 9 | + 9 | 10 | # Values that falsey values are treated as false. | @@ -84,7 +83,7 @@ S603.py:14:1: S603 `subprocess` call: check for execution of untrusted input 13 | Popen("true", shell={}) 14 | Popen("true", shell=None) | ^^^^^ S603 -15 | +15 | 16 | # Unknown values are treated as falsey. | @@ -93,7 +92,7 @@ S603.py:17:1: S603 `subprocess` call: check for execution of untrusted input 16 | # Unknown values are treated as falsey. 17 | Popen("true", shell=True if True else False) | ^^^^^ S603 -18 | +18 | 19 | # No value is also caught. | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap index 599f4b465a..ca8c9abd84 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S607_S607.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S607.py:9:11: S607 Starting a process with a partial executable path | @@ -217,6 +216,6 @@ S607.py:37:14: S607 Starting a process with a partial executable path 36 | os.spawnvpe("true") 37 | os.startfile("true") | ^^^^^^ S607 -38 | +38 | 39 | # Check it does not fail for full paths. | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap index 7de88902d2..2482ce3206 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S609_S609.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S609.py:4:10: S609 Possible wildcard injection in call due to `*` usage | 2 | import subprocess -3 | +3 | 4 | os.popen("chmod +w foo*") | ^^^^^^^^^^^^^^^ S609 5 | subprocess.Popen("/bin/chown root: *", shell=True) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap index f3be9d306b..4a8bf84b1a 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S610_S610.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S610.py:4:44: S610 Use of Django `extra` can lead to SQL injection vulnerabilities | @@ -56,7 +55,7 @@ S610.py:9:44: S610 Use of Django `extra` can lead to SQL injection vulnerabiliti 8 | User.objects.filter(username='admin').extra(where=['%secure' % 'nos']) 9 | User.objects.filter(username='admin').extra(where=['{}secure'.format('no')]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S610 -10 | +10 | 11 | query = '"username") AS "username", * FROM "auth_user" WHERE 1=1 OR "username"=? --' | @@ -65,7 +64,7 @@ S610.py:12:44: S610 Use of Django `extra` can lead to SQL injection vulnerabilit 11 | query = '"username") AS "username", * FROM "auth_user" WHERE 1=1 OR "username"=? --' 12 | User.objects.filter(username='admin').extra(select={'test': query}) | ^^^^^^^^^^^^^^^^^^^^^^^^ S610 -13 | +13 | 14 | where_var = ['1=1) OR 1=1 AND (1=1'] | @@ -74,7 +73,7 @@ S610.py:15:44: S610 Use of Django `extra` can lead to SQL injection vulnerabilit 14 | where_var = ['1=1) OR 1=1 AND (1=1'] 15 | User.objects.filter(username='admin').extra(where=where_var) | ^^^^^^^^^^^^^^^^^ S610 -16 | +16 | 17 | where_str = '1=1) OR 1=1 AND (1=1' | @@ -83,7 +82,7 @@ S610.py:18:44: S610 Use of Django `extra` can lead to SQL injection vulnerabilit 17 | where_str = '1=1) OR 1=1 AND (1=1' 18 | User.objects.filter(username='admin').extra(where=[where_str]) | ^^^^^^^^^^^^^^^^^^^ S610 -19 | +19 | 20 | tables_var = ['django_content_type" WHERE "auth_user"."username"="admin'] | @@ -92,7 +91,7 @@ S610.py:21:25: S610 Use of Django `extra` can lead to SQL injection vulnerabilit 20 | tables_var = ['django_content_type" WHERE "auth_user"."username"="admin'] 21 | User.objects.all().extra(tables=tables_var).distinct() | ^^^^^^^^^^^^^^^^^^^ S610 -22 | +22 | 23 | tables_str = 'django_content_type" WHERE "auth_user"."username"="admin' | @@ -101,6 +100,6 @@ S610.py:24:25: S610 Use of Django `extra` can lead to SQL injection vulnerabilit 23 | tables_str = 'django_content_type" WHERE "auth_user"."username"="admin' 24 | User.objects.all().extra(tables=[tables_str]).distinct() | ^^^^^^^^^^^^^^^^^^^^^ S610 -25 | +25 | 26 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap index ab65d21252..f7a16b78e4 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S612_S612.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S612.py:3:5: S612 Use of insecure `logging.config.listen` detected | 1 | import logging.config -2 | +2 | 3 | t = logging.config.listen(9999) | ^^^^^^^^^^^^^^^^^^^^^ S612 -4 | +4 | 5 | def verify_func(): | diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap index 4f83f30a53..61b156e891 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S701_S701.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S701.py:9:57: S701 Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. | @@ -28,14 +27,14 @@ S701.py:13:13: S701 Using jinja2 templates with `autoescape=False` is dangerous 12 | load=templateLoader, 13 | autoescape=False) # S701 | ^^^^^^^^^^^^^^^^ S701 -14 | +14 | 15 | Environment(loader=templateLoader, # S701 | S701.py:15:1: S701 By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities. | 13 | autoescape=False) # S701 -14 | +14 | 15 | Environment(loader=templateLoader, # S701 | ^^^^^^^^^^^ S701 16 | load=templateLoader) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap index 6d32769376..3297e5af7e 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S702_S702.py.snap @@ -1,19 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs -snapshot_kind: text --- S702.py:6:1: S702 Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks | 6 | Template("hello") | ^^^^^^^^ S702 -7 | +7 | 8 | mako.template.Template("hern") | S702.py:8:1: S702 Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks | 6 | Template("hello") -7 | +7 | 8 | mako.template.Template("hern") | ^^^^^^^^^^^^^^^^^^^^^^ S702 9 | template.Template("hern") diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap index f1360b8ab3..3220d72353 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B003_B003.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B003.py:9:1: B003 Assigning to `os.environ` doesn't clear the environment | 7 | from os import environ - 8 | + 8 | 9 | os.environ = {} | ^^^^^^^^^^ B003 10 | environ = {} # that's fine, assigning a new meaning to the module-level name 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 9513c0cf35..2d67212e68 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B004.py:3:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. | @@ -66,7 +65,7 @@ B004.py:14:8: B004 Using `hasattr(x, "__call__")` to test if x is callable is un B004.py:24:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. | 22 | return True -23 | +23 | 24 | if hasattr(o, "__call__"): | ^^^^^^^^^^^^^^^^^^^^^^ B004 25 | print("STILL a bug!") diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap index 66334d60f0..9291a453fa 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B005_B005.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B005.py:4:1: B005 Using `.strip()` with multi-character strings is misleading | @@ -78,6 +77,6 @@ B005.py:24:1: B005 Using `.strip()` with multi-character strings is misleading 23 | s.strip("\ufeff") # no warning 24 | s.strip("\u0074\u0065\u0073\u0074") # warning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B005 -25 | +25 | 26 | from somewhere import other_type, strip | 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 bf28fec160..a14c6205fc 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument defaults | 1 | # Docstring followed by a newline -2 | +2 | 3 | def foobar(foor, bar={}): | ^^ B006 4 | """ 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 09257a8d92..6148acae1a 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument defaults | 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155 -3 | +3 | 4 | def foobar(foor, bar={}): | ^^ B006 5 | """ 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 3a1addc5af..45040e91fb 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B006_6.py:4:22: B006 [*] Do not use mutable data structures for argument defaults | 2 | # Same as B006_2.py, but import instead of docstring -3 | +3 | 4 | def foobar(foor, bar={}): | ^^ B006 5 | import os 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 3cd491b156..3e00a26e6f 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B006_7.py:4:22: B006 [*] Do not use mutable data structures for argument defaults | 2 | # Same as B006_3.py, but import instead of docstring -3 | +3 | 4 | def foobar(foor, bar={}): | ^^ B006 5 | import os 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 c93320a973..1fa6c1c985 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument defaults | @@ -62,7 +61,7 @@ B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument def | 77 | def multiline_arg_wrong(value={ | _______________________________^ -78 | | +78 | | 79 | | }): | |_^ B006 80 | ... @@ -84,7 +83,7 @@ B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument def B006_B008.py:82:36: B006 Do not use mutable data structures for argument defaults | 80 | ... -81 | +81 | 82 | def single_line_func_wrong(value = {}): ... | ^^ B006 | 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 12d3aaa584..ea5052cf82 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B007.py:6:5: B007 Loop control variable `i` not used within loop body | 4 | print(i) # name no longer defined on Python 3; no warning yet -5 | +5 | 6 | for i in range(10): # name not used within the loop; B007 | ^ B007 7 | print(10) @@ -71,7 +70,7 @@ B007.py:34:10: B007 Loop control variable `bar` may not be used within loop body B007.py:38:10: B007 Loop control variable `bar` may not be used within loop body | 36 | print(FMT.format(**locals())) -37 | +37 | 38 | for foo, bar in [(1, 2)]: | ^^^ B007 39 | if foo: @@ -82,7 +81,7 @@ B007.py:38:10: B007 Loop control variable `bar` may not be used within loop body B007.py:42:10: B007 Loop control variable `bar` may not be used within loop body | 40 | print(FMT.format(**globals())) -41 | +41 | 42 | for foo, bar in [(1, 2)]: | ^^^ B007 43 | if foo: @@ -93,7 +92,7 @@ B007.py:42:10: B007 Loop control variable `bar` may not be used within loop body B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body | 44 | print(FMT.format(**vars())) -45 | +45 | 46 | for foo, bar in [(1, 2)]: | ^^^ B007 47 | print(FMT.format(foo=foo, bar=eval("bar"))) 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 5a74d284b8..5748ea4eb7 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | @@ -322,7 +321,7 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 58 | assert getattr(func, '_rpc')is True | ^^^^^^^^^^^^^^^^^^^^^ B009 -59 | +59 | 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247 | = help: Replace `getattr` with attribute access @@ -343,7 +342,7 @@ B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute valu 65 | / getattr(self. 66 | | registration.registry, '__name__') | |_____________________________________^ B009 -67 | +67 | 68 | import builtins | = help: Replace `getattr` with attribute access 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 a7f67bd8d8..42a169cb1b 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | @@ -111,7 +110,7 @@ B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute valu 54 | setattr(foo, r"abc123", None) 55 | setattr(foo.bar, r"baz", None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B010 -56 | +56 | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 | = help: Replace `setattr` with assignment diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap index 997e6b1bb9..5bbd36c330 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B012_B012.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B012.py:5:9: B012 `return` inside `finally` blocks cause exceptions to be silenced | @@ -44,7 +43,7 @@ B012.py:44:21: B012 `return` inside `finally` blocks cause exceptions to be sile 43 | finally: 44 | return # warning | ^^^^^^ B012 -45 | +45 | 46 | finally: | @@ -54,7 +53,7 @@ B012.py:66:13: B012 `break` inside `finally` blocks cause exceptions to be silen 65 | finally: 66 | break # warning | ^^^^^ B012 -67 | +67 | 68 | def j(): | @@ -64,7 +63,7 @@ B012.py:78:13: B012 `continue` inside `finally` blocks cause exceptions to be si 77 | finally: 78 | continue # warning | ^^^^^^^^ B012 -79 | +79 | 80 | def j(): | @@ -82,7 +81,7 @@ B012.py:101:9: B012 `continue` inside `finally` blocks cause exceptions to be si 100 | finally: 101 | continue # warning | ^^^^^^^^ B012 -102 | +102 | 103 | while True: | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap index 29d06e7de2..1fe419d2fd 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B015_B015.py.snap @@ -1,21 +1,20 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B015.py:3:1: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. | 1 | assert 1 == 1 -2 | +2 | 3 | 1 == 1 | ^^^^^^ B015 -4 | +4 | 5 | assert 1 in (1, 2) | B015.py:7:1: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. | 5 | assert 1 in (1, 2) -6 | +6 | 7 | 1 in (1, 2) | ^^^^^^^^^^^ B015 | @@ -23,7 +22,7 @@ B015.py:7:1: B015 Pointless comparison. Did you mean to assign a value? Otherwis B015.py:17:5: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? | 15 | assert 1 in (1, 2) -16 | +16 | 17 | 1 in (1, 2) | ^^^^^^^^^^^ B015 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap index 51d3ca8098..1a999923db 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B016_B016.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B016.py:6:7: B016 Cannot raise a literal. Did you intend to return it or raise an Exception? | 4 | """ -5 | +5 | 6 | raise False | ^^^^^ B016 7 | raise 1 diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap index 5b578e1f50..bbee0c1d91 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B017_B017.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B017.py:23:14: B017 Do not assert blind exception: `Exception` | @@ -30,7 +29,7 @@ B017.py:45:10: B017 Do not assert blind exception: `Exception` B017.py:48:10: B017 Do not assert blind exception: `Exception` | 46 | raise ValueError("Hello") -47 | +47 | 48 | with pytest.raises(Exception), pytest.raises(ValueError): | ^^^^^^^^^^^^^^^^^^^^^^^^ B017 49 | raise ValueError("Hello") @@ -39,7 +38,7 @@ B017.py:48:10: B017 Do not assert blind exception: `Exception` B017.py:57:36: B017 Do not assert blind exception: `Exception` | 55 | raise ValueError("This is also fine") -56 | +56 | 57 | with contextlib.nullcontext(), pytest.raises(Exception): | ^^^^^^^^^^^^^^^^^^^^^^^^ B017 58 | raise ValueError("Multiple context managers") diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap index c165284235..dfba309de4 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B019_B019.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B019.py:78:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | @@ -14,7 +13,7 @@ B019.py:78:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:82:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 80 | ... -81 | +81 | 82 | @cache | ^^^^^^ B019 83 | def another_cached_instance_method(self, y): @@ -24,7 +23,7 @@ B019.py:82:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:86:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 84 | ... -85 | +85 | 86 | @functools.cache() | ^^^^^^^^^^^^^^^^^^ B019 87 | def called_cached_instance_method(self, y): @@ -34,7 +33,7 @@ B019.py:86:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:90:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 88 | ... -89 | +89 | 90 | @cache() | ^^^^^^^^ B019 91 | def another_called_cached_instance_method(self, y): @@ -44,7 +43,7 @@ B019.py:90:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:94:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 92 | ... -93 | +93 | 94 | @functools.lru_cache | ^^^^^^^^^^^^^^^^^^^^ B019 95 | def lru_cached_instance_method(self, y): @@ -54,7 +53,7 @@ B019.py:94:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:98:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 96 | ... - 97 | + 97 | 98 | @lru_cache | ^^^^^^^^^^ B019 99 | def another_lru_cached_instance_method(self, y): @@ -64,7 +63,7 @@ B019.py:98:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:102:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 100 | ... -101 | +101 | 102 | @functools.lru_cache() | ^^^^^^^^^^^^^^^^^^^^^^ B019 103 | def called_lru_cached_instance_method(self, y): @@ -74,7 +73,7 @@ B019.py:102:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods B019.py:106:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks | 104 | ... -105 | +105 | 106 | @lru_cache() | ^^^^^^^^^^^^ B019 107 | def another_called_lru_cached_instance_method(self, y): diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap index 8fb15a2263..b734156c72 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B020_B020.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B020.py:8:5: B020 Loop control variable `items` overrides iterable it iterates | 6 | items = [1, 2, 3] -7 | +7 | 8 | for items in items: | ^^^^^ B020 9 | print(items) @@ -14,7 +13,7 @@ B020.py:8:5: B020 Loop control variable `items` overrides iterable it iterates B020.py:21:10: B020 Loop control variable `values` overrides iterable it iterates | 19 | print(f"{key}, {value}") -20 | +20 | 21 | for key, values in values.items(): | ^^^^^^ B020 22 | print(f"{key}, {values}") diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap index 6468cffbd7..32c3200f25 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B021_B021.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B021.py:1:1: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. | @@ -9,7 +8,7 @@ B021.py:1:1: B021 f-string used as docstring. Python will interpret this as a jo 3 | | B021 - on lines 14, 22, 30, 38, 46, 54, 62, 70, 73 4 | | """ | |___^ B021 -5 | +5 | 6 | VARIABLE = "world" | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap index 28dadc3836..d5b4902139 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B022_B022.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B022.py:9:6: B022 No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant | 7 | from contextlib import suppress - 8 | + 8 | 9 | with contextlib.suppress(): | ^^^^^^^^^^^^^^^^^^^^^ B022 10 | raise ValueError @@ -14,7 +13,7 @@ B022.py:9:6: B022 No arguments passed to `contextlib.suppress`. No exceptions wi B022.py:12:6: B022 No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant | 10 | raise ValueError -11 | +11 | 12 | with suppress(): | ^^^^^^^^^^ B022 13 | raise ValueError diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap index 500183278d..0ee9c53938 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B023_B023.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B023.py:12:30: B023 Function definition does not bind loop variable `x` | @@ -17,7 +16,7 @@ B023.py:13:30: B023 Function definition does not bind loop variable `y` 12 | functions.append(lambda: x) 13 | functions.append(lambda: y) # not just the loop var | ^ B023 -14 | +14 | 15 | def f_bad_1(): | @@ -26,7 +25,7 @@ B023.py:16:16: B023 Function definition does not bind loop variable `x` 15 | def f_bad_1(): 16 | return x | ^ B023 -17 | +17 | 18 | # Actually OK | @@ -72,14 +71,14 @@ B023.py:40:34: B023 Function definition does not bind loop variable `x` 39 | async for x in pointless_async_iterable(): 40 | functions.append(lambda: x) # error | ^ B023 -41 | +41 | 42 | [lambda: x async for x in pointless_async_iterable()] # error | B023.py:42:14: B023 Function definition does not bind loop variable `x` | 40 | functions.append(lambda: x) # error -41 | +41 | 42 | [lambda: x async for x in pointless_async_iterable()] # error | ^ B023 | @@ -146,7 +145,7 @@ B023.py:68:10: B023 Function definition does not bind loop variable `l` 67 | j = None # OK because it's an assignment 68 | [l for k in range(2)] # error for l, not for k | ^ B023 -69 | +69 | 70 | assert a and functions | @@ -202,7 +201,7 @@ B023.py:121:37: B023 Function definition does not bind loop variable `x` 120 | list(filter(bool, [None, lambda: x])) 121 | all(reduce(bool, [None, lambda: x])) | ^ B023 -122 | +122 | 123 | # But all these should be OK: | @@ -211,7 +210,7 @@ B023.py:171:29: B023 Function definition does not bind loop variable `name` 170 | if foo(name): 171 | return [lambda: name] # known false alarm | ^^^^ B023 -172 | +172 | 173 | if False: | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap index f8d765b4e0..cf6ec73378 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B028_B028.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B028.py:8:1: B028 [*] No explicit `stacklevel` keyword argument found | 6 | """ - 7 | + 7 | 8 | warnings.warn("test", DeprecationWarning) | ^^^^^^^^^^^^^ B028 9 | warnings.warn("test", DeprecationWarning, source=None) @@ -47,7 +46,7 @@ B028.py:9:1: B028 [*] No explicit `stacklevel` keyword argument found B028.py:22:1: B028 [*] No explicit `stacklevel` keyword argument found | 20 | warnings.warn(*args, **kwargs) -21 | +21 | 22 | warnings.warn( | ^^^^^^^^^^^^^ B028 23 | "test", diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap index 57ecefcc16..776d2e3882 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B029_B029.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B029.py:8:1: B029 Using `except ():` with an empty tuple does not catch anything; add exceptions to handle | @@ -9,7 +8,7 @@ B029.py:8:1: B029 Using `except ():` with an empty tuple does not catch anything 8 | / except (): 9 | | pass | |________^ B029 -10 | +10 | 11 | try: | @@ -20,7 +19,7 @@ B029.py:13:1: B029 Using `except ():` with an empty tuple does not catch anythin 13 | / except () as e: 14 | | pass | |________^ B029 -15 | +15 | 16 | try: | @@ -31,7 +30,7 @@ B029.py:18:1: B029 Using `except* ():` with an empty tuple does not catch anythi 18 | / except* (): 19 | | pass | |________^ B029 -20 | +20 | 21 | try: | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap index 57ca85a502..b13db50fcd 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B031_B031.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B031.py:27:37: B031 Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage | @@ -18,7 +17,7 @@ B031.py:29:33: B031 Using the generator returned from `itertools.groupby()` more 28 | # We're outside the nested loop and used the group again. 29 | collect_shop_items(shopper, section_items) # B031 | ^^^^^^^^^^^^^ B031 -30 | +30 | 31 | for _section, section_items in groupby(items, key=lambda p: p[1]): | @@ -45,7 +44,7 @@ B031.py:46:29: B031 Using the generator returned from `itertools.groupby()` more 45 | for _section, section_items in groupby(items, key=lambda p: p[1]): 46 | collection.append([list(section_items) for _ in range(3)]) # B031 | ^^^^^^^^^^^^^ B031 -47 | +47 | 48 | unique_items = set() | @@ -63,7 +62,7 @@ B031.py:79:37: B031 Using the generator returned from `itertools.groupby()` more 78 | for shopper in shoppers: 79 | collect_shop_items(shopper, section_items) # B031 | ^^^^^^^^^^^^^ B031 -80 | +80 | 81 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | @@ -72,7 +71,7 @@ B031.py:82:38: B031 Using the generator returned from `itertools.groupby()` more 81 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): 82 | _ = [collect_shop_items(shopper, section_items) for shopper in shoppers] # B031 | ^^^^^^^^^^^^^ B031 -83 | +83 | 84 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | @@ -82,7 +81,7 @@ B031.py:94:65: B031 Using the generator returned from `itertools.groupby()` more 93 | # The iterator is being used for the second time. 94 | _ = [(item1, item2) for item1 in section_items for item2 in section_items] # B031 | ^^^^^^^^^^^^^ B031 -95 | +95 | 96 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | @@ -92,7 +91,7 @@ B031.py:101:37: B031 Using the generator returned from `itertools.groupby()` mor 100 | collect_shop_items(shopper, section_items) 101 | collect_shop_items(shopper, section_items) # B031 | ^^^^^^^^^^^^^ B031 -102 | +102 | 103 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | @@ -152,7 +151,7 @@ B031.py:126:33: B031 Using the generator returned from `itertools.groupby()` mor 125 | # Now, it should detect 126 | collect_shop_items(shopper, section_items) # B031 | ^^^^^^^^^^^^^ B031 -127 | +127 | 128 | for _section, section_items in itertools.groupby(items, key=lambda p: p[1]): | @@ -192,7 +191,7 @@ B031.py:144:33: B031 Using the generator returned from `itertools.groupby()` mor 143 | # Now, it should detect 144 | collect_shop_items(shopper, section_items) # B031 | ^^^^^^^^^^^^^ B031 -145 | +145 | 146 | for group in groupby(items, key=lambda p: p[1]): | @@ -211,7 +210,7 @@ B031.py:210:37: B031 Using the generator returned from `itertools.groupby()` mor 209 | collect_shop_items(shopper, section_items) 210 | collect_shop_items(shopper, section_items) | ^^^^^^^^^^^^^ B031 -211 | +211 | 212 | # Should trigger, since only one branch has a return statement. | @@ -221,6 +220,6 @@ B031.py:219:33: B031 Using the generator returned from `itertools.groupby()` mor 218 | collect_shop_items(shopper, section_items) 219 | collect_shop_items(shopper, section_items) # B031 | ^^^^^^^^^^^^^ B031 -220 | +220 | 221 | # Let's redefine the `groupby` function to make sure we pick up the correct one. | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap index 2826619574..dd53337080 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B032_B032.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B032.py:9:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? | 7 | dct = {"a": 1} - 8 | + 8 | 9 | dct["b"]: 2 | ^^^^^^^^^^^ B032 10 | dct.b: 2 @@ -16,14 +15,14 @@ B032.py:10:1: B032 Possible unintentional type annotation (using `:`). Did you m 9 | dct["b"]: 2 10 | dct.b: 2 | ^^^^^^^^ B032 -11 | +11 | 12 | dct["b"]: "test" | B032.py:12:1: B032 Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)? | 10 | dct.b: 2 -11 | +11 | 12 | dct["b"]: "test" | ^^^^^^^^^^^^^^^^ B032 13 | dct.b: "test" @@ -34,7 +33,7 @@ B032.py:13:1: B032 Possible unintentional type annotation (using `:`). Did you m 12 | dct["b"]: "test" 13 | dct.b: "test" | ^^^^^^^^^^^^^ B032 -14 | +14 | 15 | test = "test" | @@ -72,6 +71,6 @@ B032.py:19:1: B032 Possible unintentional type annotation (using `:`). Did you m 18 | dct.b: test 19 | dct.b: test.lower() | ^^^^^^^^^^^^^^^^^^^ B032 -20 | +20 | 21 | # Do not flag below | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap index db3e493b68..d04d48aa93 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B033.py:4:35: B033 [*] Sets should not contain duplicate item `"value1"` | @@ -174,7 +173,7 @@ B033.py:22:28: B033 [*] Sets should not contain duplicate items, but `False` and 21 | } 22 | incorrect_set = {False, 1, 0} | ^ B033 -23 | +23 | 24 | ### | = help: Remove duplicate item diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap index 066befba4c..c92b98b7d5 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B034_B034.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B034.py:5:1: B034 `re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions | @@ -96,6 +95,6 @@ B034.py:14:1: B034 `re.sub` should pass `count` and `flags` as keyword arguments 13 | re.split(" ", "a a a a", 2, re.I) 14 | sub("a", "b", "aaa", re.IGNORECASE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B034 -15 | +15 | 16 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap index 429f011542..8b7b9add10 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B039_B039.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B039.py:21:26: B039 Do not use mutable data structures for `ContextVar` defaults | @@ -116,7 +115,7 @@ B039.py:31:36: B039 Do not use mutable data structures for `ContextVar` defaults 30 | ContextVar("cv", default=set[str]()) 31 | ContextVar[set[str]]("cv", default=set[str]()) | ^^^^^^^^^^ B039 -32 | +32 | 33 | def bar() -> list[int]: | = help: Replace with `None`; initialize with `.set()`` @@ -124,7 +123,7 @@ B039.py:31:36: B039 Do not use mutable data structures for `ContextVar` defaults B039.py:36:26: B039 Do not use mutable data structures for `ContextVar` defaults | 34 | return [1, 2, 3] -35 | +35 | 36 | ContextVar("cv", default=bar()) | ^^^^^ B039 37 | ContextVar("cv", default=time.time()) @@ -136,7 +135,7 @@ B039.py:37:26: B039 Do not use mutable data structures for `ContextVar` defaults 36 | ContextVar("cv", default=bar()) 37 | ContextVar("cv", default=time.time()) | ^^^^^^^^^^^ B039 -38 | +38 | 39 | def baz(): ... | = help: Replace with `None`; initialize with `.set()`` diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap index 7538d0c1a4..8d98e5fcd4 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B901_B901.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B901.py:9:9: B901 Using `yield` and `return {value}` in a generator function can lead to confusing behavior | @@ -8,7 +7,7 @@ B901.py:9:9: B901 Using `yield` and `return {value}` in a generator function can 8 | if True: 9 | return [1, 2, 3] | ^^^^^^^^^^^^^^^^ B901 -10 | +10 | 11 | yield 3 | @@ -17,6 +16,6 @@ B901.py:36:5: B901 Using `yield` and `return {value}` in a generator function ca 35 | def broken2(): 36 | return [3, 2, 1] | ^^^^^^^^^^^^^^^^ B901 -37 | +37 | 38 | yield from not_broken() | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B903_class_as_data_structure.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B903_class_as_data_structure.py.snap index eea9b90dd5..0d3826aea6 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B903_class_as_data_structure.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B903_class_as_data_structure.py.snap @@ -13,27 +13,27 @@ class_as_data_structure.py:6:1: B903 Class could be dataclass or namedtuple class_as_data_structure.py:40:1: B903 Class could be dataclass or namedtuple | 38 | ... -39 | +39 | 40 | / class C: # B903 41 | | c: int 42 | | def __init__(self,d:list): 43 | | self.d = d | |__________________^ B903 -44 | +44 | 45 | class D: # B903 | class_as_data_structure.py:45:1: B903 Class could be dataclass or namedtuple | 43 | self.d = d -44 | +44 | 45 | / class D: # B903 46 | | """This class has a docstring.""" 47 | | # this next method is an init 48 | | def __init__(self,e:dict): 49 | | self.e = e | |__________________^ B903 -50 | +50 | 51 | # <--- begin flake8-bugbear tests below | @@ -41,7 +41,7 @@ class_as_data_structure.py:63:1: B903 Class could be dataclass or namedtuple | 63 | / class NoWarningsClassAttributes: 64 | | spam = "ham" -65 | | +65 | | 66 | | def __init__(self, foo:int, bar:list): 67 | | self.foo = foo 68 | | self.bar = bar @@ -61,11 +61,11 @@ class_as_data_structure.py:91:1: B903 Class could be dataclass or namedtuple | 91 | / class WarningsWithDocstring: 92 | | """A docstring should not be an impediment to a warning""" -93 | | +93 | | 94 | | def __init__(self, foo:int, bar:list): 95 | | self.foo = foo 96 | | self.bar = bar | |______________________^ B903 -97 | +97 | 98 | # <-- end flake8-bugbear tests | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap index dc4604c1bf..1d7390ce04 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B904_B904.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B904.py:10:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling | @@ -66,7 +65,7 @@ B904.py:73:13: B904 Within an `except` clause, raise exceptions with `raise ... 72 | case 0: 73 | raise RuntimeError("boom!") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904 -74 | +74 | 75 | try: | @@ -86,7 +85,7 @@ B904.py:81:9: B904 Within an `except*` clause, raise exceptions with `raise ... 80 | else: 81 | raise RuntimeError("bang!") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B904 -82 | +82 | 83 | try: | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap index 899a911b38..4628deaeec 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B905.py:4:1: B905 [*] `zip()` without an explicit `strict=` parameter | @@ -132,7 +131,7 @@ B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter 8 | zip(zip("a"), strict=False) 9 | zip(zip("a", strict=True)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ B905 -10 | +10 | 11 | # OK | = help: Add explicit value for parameter `strict=` @@ -172,7 +171,7 @@ B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter 24 | zip([1, 2, 3], repeat(1, 1)) 25 | zip([1, 2, 3], repeat(1, times=4)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B905 -26 | +26 | 27 | import builtins | = help: Add explicit value for parameter `strict=` diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap index 076f46987f..c7385dec29 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B909_B909.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B909.py:12:5: B909 Mutation to loop iterable `some_list` during iteration | @@ -97,7 +96,7 @@ B909.py:21:5: B909 Mutation to loop iterable `some_list` during iteration 20 | some_list.pop(1) 21 | some_list.pop() | ^^^^^^^^^^^^^ B909 -22 | +22 | 23 | # conditional break should error | @@ -136,7 +135,7 @@ B909.py:49:5: B909 Mutation to loop iterable `mydicts` during iteration 48 | mydicts.setdefault("foo", 1) 49 | mydicts.update({"foo": "bar"}) | ^^^^^^^^^^^^^^ B909 -50 | +50 | 51 | # no errors | @@ -195,7 +194,7 @@ B909.py:67:5: B909 Mutation to loop iterable `myset` during iteration 66 | myset.add(4) 67 | myset.discard(3) | ^^^^^^^^^^^^^ B909 -68 | +68 | 69 | # no errors | @@ -261,7 +260,7 @@ B909.py:97:5: B909 Mutation to loop iterable `foo` during iteration 96 | foo[1:2] = bar 97 | foo[1:2:3] = bar | ^^^^^^^^^^^^^^^^ B909 -98 | +98 | 99 | foo = {1, 2, 3} | @@ -318,7 +317,7 @@ B909.py:136:9: B909 Mutation to loop iterable `foo` during iteration 135 | else: 136 | foo.remove(1) | ^^^^^^^^^^ B909 -137 | +137 | 138 | # should error | @@ -366,7 +365,7 @@ B909.py:159:5: B909 Mutation to loop iterable `some_list` during iteration 158 | some_list.remove(elem) 159 | some_list.discard(elem) | ^^^^^^^^^^^^^^^^^ B909 -160 | +160 | 161 | # should not error | @@ -376,6 +375,6 @@ B909.py:167:5: B909 Mutation to loop iterable `some_list` during iteration 166 | for i, elem in enumerate(some_list): 167 | some_list.pop(0) | ^^^^^^^^^^^^^ B909 -168 | +168 | 169 | # should not error (list) | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B911_B911.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B911_B911.py.snap index 850a173070..1ce2005be7 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B911_B911.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B911_B911.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs -snapshot_kind: text --- B911.py:5:1: B911 `itertools.batched()` without an explicit `strict` parameter | @@ -50,7 +49,7 @@ B911.py:9:1: B911 `itertools.batched()` without an explicit `strict` parameter 8 | batched((foo for foo in cycle())) 9 | batched(itertools.batched([1, 2, 3], strict=True)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B911 -10 | +10 | 11 | # Errors (limited iterators). | = help: Add an explicit `strict` parameter @@ -70,7 +69,7 @@ B911.py:13:1: B911 `itertools.batched()` without an explicit `strict` parameter 12 | batched(repeat(1, 1)) 13 | batched(repeat(1, times=4)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B911 -14 | +14 | 15 | # No fix | = help: Add an explicit `strict` parameter @@ -80,7 +79,7 @@ B911.py:16:1: B911 `itertools.batched()` without an explicit `strict` parameter 15 | # No fix 16 | batched([], **kwargs) | ^^^^^^^^^^^^^^^^^^^^^ B911 -17 | +17 | 18 | # No errors | = help: Add an explicit `strict` parameter @@ -133,7 +132,7 @@ B911.py:39:1: B911 `itertools.batched()` without an explicit `strict` parameter 38 | itertools.batched((foo for foo in cycle())) 39 | itertools.batched(itertools.batched([1, 2, 3], strict=True)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B911 -40 | +40 | 41 | # Errors (limited iterators). | = help: Add an explicit `strict` parameter @@ -153,7 +152,7 @@ B911.py:43:1: B911 `itertools.batched()` without an explicit `strict` parameter 42 | itertools.batched(repeat(1, 1)) 43 | itertools.batched(repeat(1, times=4)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B911 -44 | +44 | 45 | # No fix | = help: Add an explicit `strict` parameter @@ -163,7 +162,7 @@ B911.py:46:1: B911 `itertools.batched()` without an explicit `strict` parameter 45 | # No fix 46 | itertools.batched([], **kwargs) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B911 -47 | +47 | 48 | # No errors | = help: Add an explicit `strict` parameter diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap index f427fe7ac2..9baa2d0270 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A001.py:5:1: A001 Variable `print` is shadowing a Python builtin | 3 | from directory import new as dir -4 | +4 | 5 | print = 1 | ^^^^^ A001 6 | copyright: 'annotation' = 2 @@ -55,7 +54,7 @@ A001.py:9:1: A001 Variable `min` is shadowing a Python builtin 8 | float = object = 4 9 | min, max = 5, 6 | ^^^ A001 -10 | +10 | 11 | id = 4 | @@ -65,24 +64,24 @@ A001.py:9:6: A001 Variable `max` is shadowing a Python builtin 8 | float = object = 4 9 | min, max = 5, 6 | ^^^ A001 -10 | +10 | 11 | id = 4 | A001.py:11:1: A001 Variable `id` is shadowing a Python builtin | 9 | min, max = 5, 6 -10 | +10 | 11 | id = 4 | ^^ A001 -12 | +12 | 13 | def bytes(): | A001.py:13:5: A001 Variable `bytes` is shadowing a Python builtin | 11 | id = 4 -12 | +12 | 13 | def bytes(): | ^^^^^ A001 14 | pass @@ -91,7 +90,7 @@ A001.py:13:5: A001 Variable `bytes` is shadowing a Python builtin A001.py:16:7: A001 Variable `slice` is shadowing a Python builtin | 14 | pass -15 | +15 | 16 | class slice: | ^^^^^ A001 17 | pass @@ -109,7 +108,7 @@ A001.py:21:23: A001 Variable `ValueError` is shadowing a Python builtin A001.py:24:5: A001 Variable `memoryview` is shadowing a Python builtin | 22 | ... -23 | +23 | 24 | for memoryview, *bytearray in []: | ^^^^^^^^^^ A001 25 | pass @@ -118,7 +117,7 @@ A001.py:24:5: A001 Variable `memoryview` is shadowing a Python builtin A001.py:24:18: A001 Variable `bytearray` is shadowing a Python builtin | 22 | ... -23 | +23 | 24 | for memoryview, *bytearray in []: | ^^^^^^^^^ A001 25 | pass @@ -127,7 +126,7 @@ A001.py:24:18: A001 Variable `bytearray` is shadowing a Python builtin A001.py:27:22: A001 Variable `str` is shadowing a Python builtin | 25 | pass -26 | +26 | 27 | with open('file') as str, open('file2') as (all, any): | ^^^ A001 28 | pass @@ -136,7 +135,7 @@ A001.py:27:22: A001 Variable `str` is shadowing a Python builtin A001.py:27:45: A001 Variable `all` is shadowing a Python builtin | 25 | pass -26 | +26 | 27 | with open('file') as str, open('file2') as (all, any): | ^^^ A001 28 | pass @@ -145,7 +144,7 @@ A001.py:27:45: A001 Variable `all` is shadowing a Python builtin A001.py:27:50: A001 Variable `any` is shadowing a Python builtin | 25 | pass -26 | +26 | 27 | with open('file') as str, open('file2') as (all, any): | ^^^ A001 28 | pass @@ -154,7 +153,7 @@ A001.py:27:50: A001 Variable `any` is shadowing a Python builtin A001.py:30:8: A001 Variable `sum` is shadowing a Python builtin | 28 | pass -29 | +29 | 30 | [0 for sum in ()] | ^^^ A001 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap index 1f2554d95b..10d6961236 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A001_A001.py_builtins_ignorelist.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A001.py:5:1: A001 Variable `print` is shadowing a Python builtin | 3 | from directory import new as dir -4 | +4 | 5 | print = 1 | ^^^^^ A001 6 | copyright: 'annotation' = 2 @@ -55,7 +54,7 @@ A001.py:9:1: A001 Variable `min` is shadowing a Python builtin 8 | float = object = 4 9 | min, max = 5, 6 | ^^^ A001 -10 | +10 | 11 | id = 4 | @@ -65,14 +64,14 @@ A001.py:9:6: A001 Variable `max` is shadowing a Python builtin 8 | float = object = 4 9 | min, max = 5, 6 | ^^^ A001 -10 | +10 | 11 | id = 4 | A001.py:13:5: A001 Variable `bytes` is shadowing a Python builtin | 11 | id = 4 -12 | +12 | 13 | def bytes(): | ^^^^^ A001 14 | pass @@ -81,7 +80,7 @@ A001.py:13:5: A001 Variable `bytes` is shadowing a Python builtin A001.py:16:7: A001 Variable `slice` is shadowing a Python builtin | 14 | pass -15 | +15 | 16 | class slice: | ^^^^^ A001 17 | pass @@ -99,7 +98,7 @@ A001.py:21:23: A001 Variable `ValueError` is shadowing a Python builtin A001.py:24:5: A001 Variable `memoryview` is shadowing a Python builtin | 22 | ... -23 | +23 | 24 | for memoryview, *bytearray in []: | ^^^^^^^^^^ A001 25 | pass @@ -108,7 +107,7 @@ A001.py:24:5: A001 Variable `memoryview` is shadowing a Python builtin A001.py:24:18: A001 Variable `bytearray` is shadowing a Python builtin | 22 | ... -23 | +23 | 24 | for memoryview, *bytearray in []: | ^^^^^^^^^ A001 25 | pass @@ -117,7 +116,7 @@ A001.py:24:18: A001 Variable `bytearray` is shadowing a Python builtin A001.py:27:22: A001 Variable `str` is shadowing a Python builtin | 25 | pass -26 | +26 | 27 | with open('file') as str, open('file2') as (all, any): | ^^^ A001 28 | pass @@ -126,7 +125,7 @@ A001.py:27:22: A001 Variable `str` is shadowing a Python builtin A001.py:27:45: A001 Variable `all` is shadowing a Python builtin | 25 | pass -26 | +26 | 27 | with open('file') as str, open('file2') as (all, any): | ^^^ A001 28 | pass @@ -135,7 +134,7 @@ A001.py:27:45: A001 Variable `all` is shadowing a Python builtin A001.py:27:50: A001 Variable `any` is shadowing a Python builtin | 25 | pass -26 | +26 | 27 | with open('file') as str, open('file2') as (all, any): | ^^^ A001 28 | pass @@ -144,7 +143,7 @@ A001.py:27:50: A001 Variable `any` is shadowing a Python builtin A001.py:30:8: A001 Variable `sum` is shadowing a Python builtin | 28 | pass -29 | +29 | 30 | [0 for sum in ()] | ^^^ A001 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap index 3edffeef74..082f3e3d5c 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A003.py:17:31: A003 Python builtin is shadowed by method `str` from line 14 | 15 | pass -16 | +16 | 17 | def method_usage(self) -> str: | ^^^ A003 18 | pass @@ -14,7 +13,7 @@ A003.py:17:31: A003 Python builtin is shadowed by method `str` from line 14 A003.py:20:34: A003 Python builtin is shadowed by class attribute `id` from line 3 | 18 | pass -19 | +19 | 20 | def attribute_usage(self) -> id: | ^^ A003 21 | pass diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap index 484aa22247..85f5360b44 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A003.py:17:31: A003 Python builtin is shadowed by method `str` from line 14 | 15 | pass -16 | +16 | 17 | def method_usage(self) -> str: | ^^^ A003 18 | pass diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap index 4685dcb9a5..6c8386ed14 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A004.py:1:16: A004 Import `sum` is shadowing a Python builtin | @@ -53,7 +52,7 @@ A004.py:5:30: A004 Import `dir` is shadowing a Python builtin 4 | from some import input, exec 5 | from directory import new as dir | ^^^ A004 -6 | +6 | 7 | # See: https://github.com/astral-sh/ruff/issues/13037 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_py38.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_py38.snap index 10b925931c..b8389e0889 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_py38.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A004_A004.py_py38.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A004.py:1:16: A004 Import `sum` is shadowing a Python builtin | @@ -53,6 +52,6 @@ A004.py:5:30: A004 Import `dir` is shadowing a Python builtin 4 | from some import input, exec 5 | from directory import new as dir | ^^^ A004 -6 | +6 | 7 | # See: https://github.com/astral-sh/ruff/issues/13037 | diff --git a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap index 9ce6c7d1dd..9c968e14f7 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_builtins/snapshots/ruff_linter__rules__flake8_builtins__tests__A006_A006.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_builtins/mod.rs -snapshot_kind: text --- A006.py:1:8: A006 Lambda argument `print` is shadowing a Python builtin | @@ -62,6 +61,6 @@ A006.py:5:8: A006 Lambda argument `dir` is shadowing a Python builtin 4 | lambda id: id 5 | lambda dir: dir | ^^^ A006 -6 | +6 | 7 | # Ok for A006 - should trigger A002 instead | diff --git a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap index 4133bee4d5..580392a499 100644 --- a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81_syntax_error.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_commas/mod.rs -snapshot_kind: text --- COM81_syntax_error.py:3:5: SyntaxError: Starred expression cannot be used here | @@ -14,7 +13,7 @@ COM81_syntax_error.py:3:5: SyntaxError: Starred expression cannot be used here COM81_syntax_error.py:6:9: SyntaxError: Type parameter list cannot be empty | 4 | ) -5 | +5 | 6 | def foo[(param1='test', param2='test',): | ^ 7 | pass @@ -23,7 +22,7 @@ COM81_syntax_error.py:6:9: SyntaxError: Type parameter list cannot be empty COM81_syntax_error.py:6:38: COM819 Trailing comma prohibited | 4 | ) -5 | +5 | 6 | def foo[(param1='test', param2='test',): | ^ COM819 7 | pass 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 440342ef81..f5a75e8d17 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 @@ -72,7 +72,7 @@ C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) 11 | | x for x in range(3) 12 | | ) | |_^ C400 -13 | +13 | 14 | # Strip parentheses from inner generators. | = help: Rewrite using `list()` @@ -135,7 +135,7 @@ C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a list comprehension) 16 | list(((2 * x for x in range(3)))) 17 | list((((2 * x for x in range(3))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C400 -18 | +18 | 19 | # Not built-in list. | = help: Rewrite as a list comprehension 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 fab816dd97..57ce5fc2b5 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 @@ -50,7 +50,7 @@ C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a set comprehension) 5 | ) 6 | small_nums = f"{set(a if a < 6 else 0 for a in range(3))}" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C401 -7 | +7 | 8 | def f(x): | = help: Rewrite as a set comprehension @@ -68,7 +68,7 @@ C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a set comprehension) C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a set comprehension) | 9 | return x -10 | +10 | 11 | print(f"Hello {set(f(a) for a in 'abc')} World") | ^^^^^^^^^^^^^^^^^^^^^^^^ C401 12 | print(f"Hello { set(f(a) for a in 'abc') } World") 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 58382cb5e4..12c426627a 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 @@ -130,7 +130,7 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a dict comprehension) 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 | print(f'Hello {dict((x,x) for x in "abc")} World') | ^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 -11 | +11 | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' | = help: Rewrite as a dict comprehension @@ -148,7 +148,7 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a dict comprehension) C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a dict comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 | +11 | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -168,7 +168,7 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a dict comprehension) C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a dict comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 | +11 | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -190,7 +190,7 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a dict comprehension) 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 -14 | +14 | 15 | def f(x): | = help: Rewrite as a dict comprehension @@ -210,7 +210,7 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a dict comprehension) 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 -14 | +14 | 15 | def f(x): | = help: Rewrite as a dict comprehension @@ -228,10 +228,10 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a dict comprehension) C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a dict comprehension) | 16 | return x -17 | +17 | 18 | print(f'Hello {dict((x,f(x)) for x in "abc")} World') | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 -19 | +19 | 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 | = help: Rewrite as a dict comprehension @@ -251,7 +251,7 @@ C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a dict comprehension) 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 -22 | +22 | 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940 | = help: Rewrite as a dict comprehension 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 513dabb532..6ea5a28385 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 @@ -25,7 +25,7 @@ C403.py:2:5: C403 [*] Unnecessary list comprehension (rewrite as a set comprehen 3 | | [x for x in range(3)] 4 | | ) | |_^ C403 -5 | +5 | 6 | s = f"{set([x for x in 'ab'])}" | = help: Rewrite as a set comprehension @@ -45,7 +45,7 @@ C403.py:2:5: C403 [*] Unnecessary list comprehension (rewrite as a set comprehen C403.py:6:8: C403 [*] Unnecessary list comprehension (rewrite as a set comprehension) | 4 | ) -5 | +5 | 6 | s = f"{set([x for x in 'ab'])}" | ^^^^^^^^^^^^^^^^^^^^^^ C403 7 | s = f'{set([x for x in "ab"])}' @@ -67,7 +67,7 @@ C403.py:7:8: C403 [*] Unnecessary list comprehension (rewrite as a set comprehen 6 | s = f"{set([x for x in 'ab'])}" 7 | s = f'{set([x for x in "ab"])}' | ^^^^^^^^^^^^^^^^^^^^^^ C403 -8 | +8 | 9 | def f(x): | = help: Rewrite as a set comprehension @@ -85,10 +85,10 @@ C403.py:7:8: C403 [*] Unnecessary list comprehension (rewrite as a set comprehen C403.py:12:8: C403 [*] Unnecessary list comprehension (rewrite as a set comprehension) | 10 | return x -11 | +11 | 12 | s = f"{set([f(x) for x in 'ab'])}" | ^^^^^^^^^^^^^^^^^^^^^^^^^ C403 -13 | +13 | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" | = help: Rewrite as a set comprehension @@ -106,7 +106,7 @@ C403.py:12:8: C403 [*] Unnecessary list comprehension (rewrite as a set comprehe C403.py:14:9: C403 [*] Unnecessary list comprehension (rewrite as a set comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" -13 | +13 | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" | ^^^^^^^^^^^^^^^^^^^^^^ C403 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -126,7 +126,7 @@ C403.py:14:9: C403 [*] Unnecessary list comprehension (rewrite as a set comprehe C403.py:14:34: C403 [*] Unnecessary list comprehension (rewrite as a set comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" -13 | +13 | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" | ^^^^^^^^^^^^^^^^^^^^^^ C403 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -148,7 +148,7 @@ C403.py:15:8: C403 [*] Unnecessary list comprehension (rewrite as a set comprehe 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" | ^^^^^^^^^^^^^^^^^^^^^^ C403 -16 | +16 | 17 | s = set( # comment | = help: Rewrite as a set comprehension @@ -168,7 +168,7 @@ C403.py:15:33: C403 [*] Unnecessary list comprehension (rewrite as a set compreh 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" | ^^^^^^^^^^^^^^^^^^^^^^ C403 -16 | +16 | 17 | s = set( # comment | = help: Rewrite as a set comprehension @@ -186,13 +186,13 @@ C403.py:15:33: C403 [*] Unnecessary list comprehension (rewrite as a set compreh C403.py:17:5: C403 [*] Unnecessary list comprehension (rewrite as a set comprehension) | 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -16 | +16 | 17 | s = set( # comment | _____^ 18 | | [x for x in range(3)] 19 | | ) | |_^ C403 -20 | +20 | 21 | s = set([ # comment | = help: Rewrite as a set comprehension @@ -214,7 +214,7 @@ C403.py:17:5: C403 [*] Unnecessary list comprehension (rewrite as a set comprehe C403.py:21:5: C403 [*] Unnecessary list comprehension (rewrite as a set comprehension) | 19 | ) -20 | +20 | 21 | s = set([ # comment | _____^ 22 | | x for x in range(3) 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 cfea193b1c..1267401cfd 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 @@ -19,7 +19,7 @@ C404.py:1:1: C404 [*] Unnecessary list comprehension (rewrite as a dict comprehe C404.py:7:4: C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension) | 5 | return x -6 | +6 | 7 | f'{dict([(s,s) for s in "ab"])}' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -83,7 +83,7 @@ C404.py:10:4: C404 [*] Unnecessary list comprehension (rewrite as a dict compreh 9 | f"{dict([(s, s) for s in 'ab'])}" 10 | f"{dict([(s,f(s)) for s in 'ab'])}" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 -11 | +11 | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' | = help: Rewrite as a dict comprehension @@ -101,7 +101,7 @@ C404.py:10:4: C404 [*] Unnecessary list comprehension (rewrite as a dict compreh C404.py:12:4: C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 | +11 | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -121,7 +121,7 @@ C404.py:12:4: C404 [*] Unnecessary list comprehension (rewrite as a dict compreh C404.py:12:34: C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 | +11 | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -143,7 +143,7 @@ C404.py:13:5: C404 [*] Unnecessary list comprehension (rewrite as a dict compreh 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 -14 | +14 | 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 | = help: Rewrite as a dict comprehension @@ -163,7 +163,7 @@ C404.py:13:35: C404 [*] Unnecessary list comprehension (rewrite as a dict compre 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 -14 | +14 | 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 | = help: Rewrite as a dict comprehension 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 59d160bdc2..b3c7e4b5be 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 @@ -247,7 +247,7 @@ C405.py:21:4: C405 [*] Unnecessary list literal (rewrite as a set literal) 20 | f"{set(['a', 'b'])}" 21 | f'{set(["a", "b"])}' | ^^^^^^^^^^^^^^^ C405 -22 | +22 | 23 | f"{set(['a', 'b']) - set(['a'])}" | = help: Rewrite as a set literal @@ -265,7 +265,7 @@ C405.py:21:4: C405 [*] Unnecessary list literal (rewrite as a set literal) C405.py:23:4: C405 [*] Unnecessary list literal (rewrite as a set literal) | 21 | f'{set(["a", "b"])}' -22 | +22 | 23 | f"{set(['a', 'b']) - set(['a'])}" | ^^^^^^^^^^^^^^^ C405 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -286,7 +286,7 @@ C405.py:23:4: C405 [*] Unnecessary list literal (rewrite as a set literal) C405.py:23:22: C405 [*] Unnecessary list literal (rewrite as a set literal) | 21 | f'{set(["a", "b"])}' -22 | +22 | 23 | f"{set(['a', 'b']) - set(['a'])}" | ^^^^^^^^^^ C405 24 | f"{ set(['a', 'b']) - set(['a']) }" 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 8e2f993e3f..973aa65bc4 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 @@ -78,7 +78,7 @@ C408.py:4:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:14:4: C408 [*] Unnecessary `dict()` call (rewrite as a literal) | 12 | a = list() -13 | +13 | 14 | f"{dict(x='y')}" | ^^^^^^^^^^^ C408 15 | f'{dict(x="y")}' @@ -142,7 +142,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal) 16 | f"{dict()}" 17 | f"a {dict()} b" | ^^^^^^ C408 -18 | +18 | 19 | f"{dict(x='y') | dict(y='z')}" | = help: Rewrite as a literal @@ -160,7 +160,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:19:4: C408 [*] Unnecessary `dict()` call (rewrite as a literal) | 17 | f"a {dict()} b" -18 | +18 | 19 | f"{dict(x='y') | dict(y='z')}" | ^^^^^^^^^^^ C408 20 | f"{ dict(x='y') | dict(y='z') }" @@ -181,7 +181,7 @@ C408.py:19:4: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:19:18: C408 [*] Unnecessary `dict()` call (rewrite as a literal) | 17 | f"a {dict()} b" -18 | +18 | 19 | f"{dict(x='y') | dict(y='z')}" | ^^^^^^^^^^^ C408 20 | f"{ dict(x='y') | dict(y='z') }" @@ -285,7 +285,7 @@ C408.py:22:7: C408 [*] Unnecessary `dict()` call (rewrite as a literal) 21 | f"a {dict(x='y') | dict(y='z')} b" 22 | f"a { dict(x='y') | dict(y='z') } b" | ^^^^^^^^^^^ C408 -23 | +23 | 24 | dict( | = help: Rewrite as a literal @@ -306,7 +306,7 @@ C408.py:22:21: C408 [*] Unnecessary `dict()` call (rewrite as a literal) 21 | f"a {dict(x='y') | dict(y='z')} b" 22 | f"a { dict(x='y') | dict(y='z') } b" | ^^^^^^^^^^^ C408 -23 | +23 | 24 | dict( | = help: Rewrite as a literal @@ -324,12 +324,12 @@ C408.py:22:21: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:24:1: C408 [*] Unnecessary `dict()` call (rewrite as a literal) | 22 | f"a { dict(x='y') | dict(y='z') } b" -23 | +23 | 24 | / dict( 25 | | # comment 26 | | ) | |_^ C408 -27 | +27 | 28 | tuple( # comment | = help: Rewrite as a literal @@ -350,7 +350,7 @@ C408.py:24:1: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:28:1: C408 [*] Unnecessary `tuple()` call (rewrite as a literal) | 26 | ) -27 | +27 | 28 | / tuple( # comment 29 | | ) | |_^ C408 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 8e979ae7ec..17911683f1 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 @@ -81,7 +81,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal) 16 | f"{dict()}" 17 | f"a {dict()} b" | ^^^^^^ C408 -18 | +18 | 19 | f"{dict(x='y') | dict(y='z')}" | = help: Rewrite as a literal @@ -99,12 +99,12 @@ C408.py:17:6: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:24:1: C408 [*] Unnecessary `dict()` call (rewrite as a literal) | 22 | f"a { dict(x='y') | dict(y='z') } b" -23 | +23 | 24 | / dict( 25 | | # comment 26 | | ) | |_^ C408 -27 | +27 | 28 | tuple( # comment | = help: Rewrite as a literal @@ -125,7 +125,7 @@ C408.py:24:1: C408 [*] Unnecessary `dict()` call (rewrite as a literal) C408.py:28:1: C408 [*] Unnecessary `tuple()` call (rewrite as a literal) | 26 | ) -27 | +27 | 28 | / tuple( # comment 29 | | ) | |_^ C408 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 b432b42187..3b2fd728cc 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 @@ -93,7 +93,7 @@ C409.py:8:6: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the 9 | | (1, 2) 10 | | ) | |_^ C409 -11 | +11 | 12 | tuple( # comment | = help: Remove the outer call to `tuple()` @@ -113,12 +113,12 @@ C409.py:8:6: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the C409.py:12:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal) | 10 | ) -11 | +11 | 12 | / tuple( # comment 13 | | [1, 2] 14 | | ) | |_^ C409 -15 | +15 | 16 | tuple([ # comment | = help: Rewrite as a tuple literal @@ -138,12 +138,12 @@ C409.py:12:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as C409.py:16:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal) | 14 | ) -15 | +15 | 16 | / tuple([ # comment 17 | | 1, 2 18 | | ]) | |__^ C409 -19 | +19 | 20 | tuple(( | = help: Rewrite as a tuple literal @@ -164,12 +164,12 @@ C409.py:16:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as C409.py:20:1: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`) | 18 | ]) -19 | +19 | 20 | / tuple(( 21 | | 1, 22 | | )) | |__^ C409 -23 | +23 | 24 | t6 = tuple([1]) | = help: Remove the outer call to `tuple()` @@ -190,7 +190,7 @@ C409.py:20:1: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the C409.py:24:6: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal) | 22 | )) -23 | +23 | 24 | t6 = tuple([1]) | ^^^^^^^^^^ C409 25 | t7 = tuple((1,)) @@ -233,7 +233,7 @@ C409.py:26:6: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as 25 | t7 = tuple((1,)) 26 | t8 = tuple([1,]) | ^^^^^^^^^^^ C409 -27 | +27 | 28 | tuple([x for x in range(5)]) | = help: Rewrite as a tuple literal 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 f33a4ed1ff..9f9152383b 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 @@ -79,7 +79,7 @@ C410.py:7:1: C410 [*] Unnecessary list literal passed to `list()` (remove the ou 8 | | [1, 2] 9 | | ) | |_^ C410 -10 | +10 | 11 | list([ # comment | = help: Remove outer `list()` call @@ -99,7 +99,7 @@ C410.py:7:1: C410 [*] Unnecessary list literal passed to `list()` (remove the ou C410.py:11:1: C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `list()`) | 9 | ) -10 | +10 | 11 | / list([ # comment 12 | | 1, 2 13 | | ]) 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 67c6d81d1f..d32a7b5197 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 @@ -173,7 +173,7 @@ C413.py:11:1: C413 [*] Unnecessary `reversed()` call around `sorted()` 10 | reversed(sorted(x, reverse=x)) 11 | reversed(sorted(x, reverse=not x)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C413 -12 | +12 | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 | = help: Remove unnecessary `reversed()` call @@ -213,7 +213,7 @@ C413.py:15:1: C413 [*] Unnecessary `reversed()` call around `sorted()` 14 | reversed(sorted(i for i in range(42))) 15 | reversed(sorted((i for i in range(42)), reverse=True)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C413 -16 | +16 | 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 | = help: Remove unnecessary `reversed()` call 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 253374a21d..af3a238f64 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 @@ -451,7 +451,7 @@ C414.py:28:1: C414 [*] Unnecessary `reversed()` call within `sorted()` 27 | set(tuple()) 28 | sorted(reversed()) | ^^^^^^^^^^^^^^^^^^ C414 -29 | +29 | 30 | # Nested sorts with differing keyword arguments. Not flagged. | = help: Remove the inner `reversed()` call @@ -477,7 +477,7 @@ C414.py:37:27: C414 [*] Unnecessary `list()` call within `sorted()` 41 | | key=lambda xxxxx: xxxxx or "", 42 | | ) | |_^ C414 -43 | +43 | 44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( | = help: Remove the inner `list()` call @@ -495,7 +495,7 @@ C414.py:37:27: C414 [*] Unnecessary `list()` call within `sorted()` C414.py:44:27: C414 [*] Unnecessary `list()` call within `sorted()` | 42 | ) -43 | +43 | 44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( | ___________________________^ 45 | | list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx 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 2170f4ae6e..7266e76c5e 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs -snapshot_kind: text --- C416.py:6:1: C416 [*] Unnecessary list comprehension (rewrite using `list()`) | 4 | d = {"a": 1, "b": 2, "c": 3} -5 | +5 | 6 | [i for i in x] | ^^^^^^^^^^^^^^ C416 7 | {i for i in x} @@ -131,7 +130,7 @@ C416.py:25:70: C416 [*] Unnecessary list comprehension (rewrite using `list()`) 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 25 | any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]) | ^^^^^^^^^^^^^^^^^^^^^^^ C416 -26 | +26 | 27 | zz = [[1], [2], [3]] | = help: Rewrite using `list()` 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 69b8be4704..bdd83974fd 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 @@ -236,7 +236,7 @@ C417.py:14:1: C417 [*] Unnecessary `map()` usage (rewrite using a list comprehen 13 | filter(func, map(lambda v: v, nums)) 14 | list(map(lambda x, y: x * y, nums)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C417 -15 | +15 | 16 | # When inside f-string, then the fix should be surrounded by whitespace | = help: Replace `map()` with a list comprehension @@ -276,7 +276,7 @@ C417.py:18:8: C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehen 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" 18 | _ = f"{dict(map(lambda v: (v, v**2), nums))}" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C417 -19 | +19 | 20 | # False negatives. | = help: Replace `map()` with a dict comprehension @@ -296,7 +296,7 @@ C417.py:36:1: C417 [*] Unnecessary `map()` usage (rewrite using a generator expr 35 | # Error: the `x` is overridden by the inner lambda. 36 | map(lambda x: lambda x: x, range(4)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C417 -37 | +37 | 38 | # Ok because of the default parameters, and variadic arguments. | = help: Replace `map()` with a generator expression @@ -357,7 +357,7 @@ C417.py:49:1: C417 [*] Unnecessary `map()` usage (rewrite using a generator expr 48 | map(lambda x: x, (y if y else z)) 49 | map(lambda x: x, (x, y, z)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C417 -50 | +50 | 51 | # See https://github.com/astral-sh/ruff/issues/14808 | = help: Replace `map()` with a generator expression 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 4480626dc6..0a90ca25db 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 @@ -63,7 +63,7 @@ C418.py:4:1: C418 [*] Unnecessary dict comprehension passed to `dict()` (remove 5 | | {'x': 1 for x in range(10)} 6 | | ) | |_^ C418 -7 | +7 | 8 | dict({}, a=1) | = help: Remove outer `dict()` call diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap index 8a77c9290e..2a45889f36 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C420_C420.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs -snapshot_kind: text --- C420.py:6:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | @@ -61,7 +60,7 @@ C420.py:15:5: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fr C420.py:26:7: C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 24 | return data -25 | +25 | 26 | f({c: "a" for c in "12345"}) # RUF025 | ^^^^^^^^^^^^^^^^^^^^^^^^^ C420 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap index 0b220bdcf3..cdbe3af0c1 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C409_C409.py.snap @@ -93,7 +93,7 @@ C409.py:8:6: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the 9 | | (1, 2) 10 | | ) | |_^ C409 -11 | +11 | 12 | tuple( # comment | = help: Remove the outer call to `tuple()` @@ -113,12 +113,12 @@ C409.py:8:6: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the C409.py:12:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal) | 10 | ) -11 | +11 | 12 | / tuple( # comment 13 | | [1, 2] 14 | | ) | |_^ C409 -15 | +15 | 16 | tuple([ # comment | = help: Rewrite as a tuple literal @@ -138,12 +138,12 @@ C409.py:12:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as C409.py:16:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal) | 14 | ) -15 | +15 | 16 | / tuple([ # comment 17 | | 1, 2 18 | | ]) | |__^ C409 -19 | +19 | 20 | tuple(( | = help: Rewrite as a tuple literal @@ -164,12 +164,12 @@ C409.py:16:1: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as C409.py:20:1: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`) | 18 | ]) -19 | +19 | 20 | / tuple(( 21 | | 1, 22 | | )) | |__^ C409 -23 | +23 | 24 | t6 = tuple([1]) | = help: Remove the outer call to `tuple()` @@ -190,7 +190,7 @@ C409.py:20:1: C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the C409.py:24:6: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal) | 22 | )) -23 | +23 | 24 | t6 = tuple([1]) | ^^^^^^^^^^ C409 25 | t7 = tuple((1,)) @@ -233,7 +233,7 @@ C409.py:26:6: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as 25 | t7 = tuple((1,)) 26 | t8 = tuple([1,]) | ^^^^^^^^^^^ C409 -27 | +27 | 28 | tuple([x for x in range(5)]) | = help: Rewrite as a tuple literal @@ -251,7 +251,7 @@ C409.py:26:6: C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as C409.py:28:1: C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator) | 26 | t8 = tuple([1,]) -27 | +27 | 28 | tuple([x for x in range(5)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C409 29 | tuple({x for x in range(10)}) diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap index d82805ef66..05999334ca 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ001_DTZ001.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ001.py:4:1: DTZ001 `datetime.datetime()` called without a `tzinfo` argument | 3 | # no args 4 | datetime.datetime(2000, 1, 1, 0, 0, 0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ001 -5 | +5 | 6 | # none args | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter @@ -17,7 +16,7 @@ DTZ001.py:7:1: DTZ001 `tzinfo=None` passed to `datetime.datetime()` 6 | # none args 7 | datetime.datetime(2000, 1, 1, 0, 0, 0, 0, None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ001 -8 | +8 | 9 | # not none arg | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter @@ -27,7 +26,7 @@ DTZ001.py:13:1: DTZ001 `datetime.datetime()` called without a `tzinfo` argument 12 | # no kwargs 13 | datetime.datetime(2000, 1, 1, fold=1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ001 -14 | +14 | 15 | # none kwargs | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter @@ -37,7 +36,7 @@ DTZ001.py:16:1: DTZ001 `tzinfo=None` passed to `datetime.datetime()` 15 | # none kwargs 16 | datetime.datetime(2000, 1, 1, tzinfo=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ001 -17 | +17 | 18 | from datetime import datetime | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter @@ -47,7 +46,7 @@ DTZ001.py:21:1: DTZ001 `datetime.datetime()` called without a `tzinfo` argument 20 | # no args unqualified 21 | datetime(2000, 1, 1, 0, 0, 0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ001 -22 | +22 | 23 | # uses `astimezone` method | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap index d00ec8092f..34a34d1d83 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ002_DTZ002.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ002.py:4:1: DTZ002 `datetime.datetime.today()` used | 3 | # qualified 4 | datetime.datetime.today() | ^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ002 -5 | +5 | 6 | from datetime import datetime | = help: Use `datetime.datetime.now(tz=...)` instead @@ -17,7 +16,7 @@ DTZ002.py:9:1: DTZ002 `datetime.datetime.today()` used 8 | # unqualified 9 | datetime.today() | ^^^^^^^^^^^^^^^^ DTZ002 -10 | +10 | 11 | # uses `astimezone` method | = help: Use `datetime.datetime.now(tz=...)` instead diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap index f860d0aba8..b436bff261 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ003_DTZ003.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ003.py:4:1: DTZ003 `datetime.datetime.utcnow()` used | 3 | # qualified 4 | datetime.datetime.utcnow() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ003 -5 | +5 | 6 | from datetime import datetime | = help: Use `datetime.datetime.now(tz=...)` instead @@ -17,7 +16,7 @@ DTZ003.py:9:1: DTZ003 `datetime.datetime.utcnow()` used 8 | # unqualified 9 | datetime.utcnow() | ^^^^^^^^^^^^^^^^^ DTZ003 -10 | +10 | 11 | # uses `astimezone` method | = help: Use `datetime.datetime.now(tz=...)` instead diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap index c646046dcd..41c2b782a9 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ004_DTZ004.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ004.py:4:1: DTZ004 `datetime.datetime.utcfromtimestamp()` used | 3 | # qualified 4 | datetime.datetime.utcfromtimestamp(1234) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ004 -5 | +5 | 6 | from datetime import datetime | = help: Use `datetime.datetime.fromtimestamp(ts, tz=...)` instead @@ -17,7 +16,7 @@ DTZ004.py:9:1: DTZ004 `datetime.datetime.utcfromtimestamp()` used 8 | # unqualified 9 | datetime.utcfromtimestamp(1234) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ004 -10 | +10 | 11 | # uses `astimezone` method | = help: Use `datetime.datetime.fromtimestamp(ts, tz=...)` instead diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap index 114c19ca7b..b3a3ce328c 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ005_DTZ005.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ005.py:4:1: DTZ005 `datetime.datetime.now()` called without a `tz` argument | 3 | # no args 4 | datetime.datetime.now() | ^^^^^^^^^^^^^^^^^^^^^^^ DTZ005 -5 | +5 | 6 | # wrong keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -17,7 +16,7 @@ DTZ005.py:7:1: DTZ005 `datetime.datetime.now()` called without a `tz` argument 6 | # wrong keywords 7 | datetime.datetime.now(bad=datetime.timezone.utc) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ005 -8 | +8 | 9 | # none args | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -27,7 +26,7 @@ DTZ005.py:10:1: DTZ005 `tz=None` passed to `datetime.datetime.now()` 9 | # none args 10 | datetime.datetime.now(None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ005 -11 | +11 | 12 | # none keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -37,7 +36,7 @@ DTZ005.py:13:1: DTZ005 `tz=None` passed to `datetime.datetime.now()` 12 | # none keywords 13 | datetime.datetime.now(tz=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ005 -14 | +14 | 15 | from datetime import datetime | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -47,7 +46,7 @@ DTZ005.py:18:1: DTZ005 `datetime.datetime.now()` called without a `tz` argument 17 | # no args unqualified 18 | datetime.now() | ^^^^^^^^^^^^^^ DTZ005 -19 | +19 | 20 | # uses `astimezone` method | = help: Pass a `datetime.timezone` object to the `tz` parameter diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap index d0c0982f8a..7ce79909c4 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ006_DTZ006.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ006.py:4:1: DTZ006 `datetime.datetime.fromtimestamp()` called without a `tz` argument | 3 | # no args 4 | datetime.datetime.fromtimestamp(1234) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ006 -5 | +5 | 6 | # wrong keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -17,7 +16,7 @@ DTZ006.py:7:1: DTZ006 `datetime.datetime.fromtimestamp()` called without a `tz` 6 | # wrong keywords 7 | datetime.datetime.fromtimestamp(1234, bad=datetime.timezone.utc) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ006 -8 | +8 | 9 | # none args | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -27,7 +26,7 @@ DTZ006.py:10:1: DTZ006 `tz=None` passed to `datetime.datetime.fromtimestamp()` 9 | # none args 10 | datetime.datetime.fromtimestamp(1234, None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ006 -11 | +11 | 12 | # none keywords | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -37,7 +36,7 @@ DTZ006.py:13:1: DTZ006 `tz=None` passed to `datetime.datetime.fromtimestamp()` 12 | # none keywords 13 | datetime.datetime.fromtimestamp(1234, tz=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ006 -14 | +14 | 15 | from datetime import datetime | = help: Pass a `datetime.timezone` object to the `tz` parameter @@ -47,7 +46,7 @@ DTZ006.py:18:1: DTZ006 `datetime.datetime.fromtimestamp()` called without a `tz` 17 | # no args unqualified 18 | datetime.fromtimestamp(1234) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ006 -19 | +19 | 20 | # uses `astimezone` method | = help: Pass a `datetime.timezone` object to the `tz` parameter diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap index 797114eba7..06b7452962 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ007_DTZ007.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ007.py:4:1: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z | 3 | # bad format 4 | datetime.datetime.strptime("something", "%H:%M:%S%Z") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ007 -5 | +5 | 6 | # no replace or astimezone | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime @@ -17,7 +16,7 @@ DTZ007.py:7:1: DTZ007 Naive datetime constructed using `datetime.datetime.strpti 6 | # no replace or astimezone 7 | datetime.datetime.strptime("something", "something") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ007 -8 | +8 | 9 | # wrong replace | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime @@ -27,7 +26,7 @@ DTZ007.py:10:1: DTZ007 Naive datetime constructed using `datetime.datetime.strpt 9 | # wrong replace 10 | datetime.datetime.strptime("something", "something").replace(hour=1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ007 -11 | +11 | 12 | # none replace | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime @@ -37,7 +36,7 @@ DTZ007.py:13:1: DTZ007 `datetime.datetime.strptime(...).replace(tz=None)` used 12 | # none replace 13 | datetime.datetime.strptime("something", "something").replace(tzinfo=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ007 -14 | +14 | 15 | # OK | = help: Pass a `datetime.timezone` object to the `tzinfo` parameter @@ -47,7 +46,7 @@ DTZ007.py:35:1: DTZ007 Naive datetime constructed using `datetime.datetime.strpt 34 | # no replace orastimezone unqualified 35 | datetime.strptime("something", "something") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ007 -36 | +36 | 37 | # F-strings | = help: Call `.replace(tzinfo=)` or `.astimezone()` to convert to an aware datetime diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap index 86a4e68ad9..b15b8f9266 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ011_DTZ011.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ011.py:4:1: DTZ011 `datetime.date.today()` used | 3 | # qualified 4 | datetime.date.today() | ^^^^^^^^^^^^^^^^^^^^^ DTZ011 -5 | +5 | 6 | from datetime import date | = help: Use `datetime.datetime.now(tz=...).date()` instead diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap index adb19fe823..2c8ab9d321 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ012_DTZ012.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ012.py:4:1: DTZ012 `datetime.date.fromtimestamp()` used | 3 | # qualified 4 | datetime.date.fromtimestamp(1234) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DTZ012 -5 | +5 | 6 | from datetime import date | = help: Use `datetime.datetime.fromtimestamp(ts, tz=...).date()` instead diff --git a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ901_DTZ901.py.snap b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ901_DTZ901.py.snap index 29636c3fca..87a4d1a557 100644 --- a/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ901_DTZ901.py.snap +++ b/crates/ruff_linter/src/rules/flake8_datetimez/snapshots/ruff_linter__rules__flake8_datetimez__tests__DTZ901_DTZ901.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs -snapshot_kind: text --- DTZ901.py:5:1: DTZ901 Use of `datetime.datetime.max` without timezone information | @@ -17,7 +16,7 @@ DTZ901.py:6:1: DTZ901 Use of `datetime.datetime.min` without timezone informatio 5 | datetime.datetime.max 6 | datetime.datetime.min | ^^^^^^^^^^^^^^^^^^^^^ DTZ901 -7 | +7 | 8 | datetime.datetime.max.replace(year=...) | = help: Replace with `datetime.datetime.min.replace(tzinfo=...)` @@ -25,7 +24,7 @@ DTZ901.py:6:1: DTZ901 Use of `datetime.datetime.min` without timezone informatio DTZ901.py:8:1: DTZ901 Use of `datetime.datetime.max` without timezone information | 6 | datetime.datetime.min -7 | +7 | 8 | datetime.datetime.max.replace(year=...) | ^^^^^^^^^^^^^^^^^^^^^ DTZ901 9 | datetime.datetime.min.replace(hour=...) @@ -55,7 +54,7 @@ DTZ901.py:28:1: DTZ901 Use of `datetime.datetime.min` without timezone informati 27 | datetime.max 28 | datetime.min | ^^^^^^^^^^^^ DTZ901 -29 | +29 | 30 | datetime.max.replace(year=...) | = help: Replace with `datetime.datetime.min.replace(tzinfo=...)` @@ -63,7 +62,7 @@ DTZ901.py:28:1: DTZ901 Use of `datetime.datetime.min` without timezone informati DTZ901.py:30:1: DTZ901 Use of `datetime.datetime.max` without timezone information | 28 | datetime.min -29 | +29 | 30 | datetime.max.replace(year=...) | ^^^^^^^^^^^^ DTZ901 31 | datetime.min.replace(hour=...) diff --git a/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap b/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap index 70989d4cf9..3b8f68333c 100644 --- a/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap +++ b/crates/ruff_linter/src/rules/flake8_debugger/snapshots/ruff_linter__rules__flake8_debugger__tests__T100_T100.py.snap @@ -1,19 +1,18 @@ --- source: crates/ruff_linter/src/rules/flake8_debugger/mod.rs -snapshot_kind: text --- T100.py:1:1: T100 Trace found: `breakpoint` used | 1 | breakpoint() | ^^^^^^^^^^^^ T100 -2 | +2 | 3 | import pdb | T100.py:3:1: T100 Import for `pdb` found | 1 | breakpoint() -2 | +2 | 3 | import pdb | ^^^^^^^^^^ T100 4 | import builtins @@ -105,14 +104,14 @@ T100.py:15:1: T100 Import for `ptvsd` found 14 | from ptvsd import wait_for_attach 15 | import ptvsd | ^^^^^^^^^^^^ T100 -16 | +16 | 17 | breakpoint() | T100.py:17:1: T100 Trace found: `builtins.breakpoint` used | 15 | import ptvsd -16 | +16 | 17 | breakpoint() | ^^^^^^^^^^^^ T100 18 | st() diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap index ba870fb965..3ebc57f8bb 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE001_1.py.snap @@ -5,7 +5,6 @@ EXE001_1.py:1:1: EXE001 Shebang is present but file is not executable | 1 | #!/usr/bin/python | ^^^^^^^^^^^^^^^^^ EXE001 -2 | +2 | 3 | if __name__ == '__main__': | - 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 feff95aa86..5cd13ffc04 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 @@ -3,7 +3,7 @@ source: crates/ruff_linter/src/rules/flake8_executable/mod.rs --- EXE004_4.py:1:1: EXE004 [*] Avoid whitespace before shebang | -1 | / +1 | / 2 | | #!/usr/bin/env python | |____^ EXE004 | @@ -13,5 +13,3 @@ EXE004_4.py:1:1: EXE004 [*] Avoid whitespace before shebang 1 |- 2 |- #!/usr/bin/env python 1 |+#!/usr/bin/env python - - diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap index 8c9650b550..a127236782 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_fixme/mod.rs -snapshot_kind: text --- T00.py:7:3: FIX001 Line contains FIXME, consider resolving the issue | @@ -17,6 +16,6 @@ T00.py:8:3: FIX001 Line contains FIXME, consider resolving the issue 7 | # FIXME: fixme 8 | # fixme: fixme | ^^^^^ FIX001 - 9 | + 9 | 10 | # test # TODO: todo | diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap index 3d064fbd7c..b447735675 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_fixme/mod.rs -snapshot_kind: text --- T00.py:1:3: FIX002 Line contains TODO, consider resolving the issue | @@ -22,7 +21,7 @@ T00.py:2:3: FIX002 Line contains TODO, consider resolving the issue T00.py:10:10: FIX002 Line contains TODO, consider resolving the issue | 8 | # fixme: fixme - 9 | + 9 | 10 | # test # TODO: todo | ^^^^ FIX002 | 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 aab4a381d1..73d16d6ebd 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs -snapshot_kind: text --- ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" | ^^^^^^^ ISC001 -2 | +2 | 3 | _ = "abc" + "def" | = help: Combine string literals @@ -22,7 +21,7 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" | ^^^^^^^ ISC001 -2 | +2 | 3 | _ = "abc" + "def" | = help: Combine string literals @@ -37,10 +36,10 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | 36 | ) -37 | +37 | 38 | _ = """a""" """b""" | ^^^^^^^^^^^^^^^ ISC001 -39 | +39 | 40 | _ = """a | = help: Combine string literals @@ -58,13 +57,13 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | 38 | _ = """a""" """b""" -39 | +39 | 40 | _ = """a | _____^ 41 | | b""" """c 42 | | d""" | |____^ ISC001 -43 | +43 | 44 | _ = f"""a""" f"""b""" | = help: Combine string literals @@ -82,10 +81,10 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | 42 | d""" -43 | +43 | 44 | _ = f"""a""" f"""b""" | ^^^^^^^^^^^^^^^^^ ISC001 -45 | +45 | 46 | _ = f"a" "b" | = help: Combine string literals @@ -103,10 +102,10 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | 44 | _ = f"""a""" f"""b""" -45 | +45 | 46 | _ = f"a" "b" | ^^^^^^^^ ISC001 -47 | +47 | 48 | _ = """a""" "b" | = help: Combine string literals @@ -114,10 +113,10 @@ ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line ISC.py:48:5: ISC001 Implicitly concatenated string literals on one line | 46 | _ = f"a" "b" -47 | +47 | 48 | _ = """a""" "b" | ^^^^^^^^^^^ ISC001 -49 | +49 | 50 | _ = 'a' "b" | = help: Combine string literals @@ -125,10 +124,10 @@ ISC.py:48:5: ISC001 Implicitly concatenated string literals on one line ISC.py:50:5: ISC001 Implicitly concatenated string literals on one line | 48 | _ = """a""" "b" -49 | +49 | 50 | _ = 'a' "b" | ^^^^^^^ ISC001 -51 | +51 | 52 | _ = rf"a" rf"b" | = help: Combine string literals @@ -136,10 +135,10 @@ ISC.py:50:5: ISC001 Implicitly concatenated string literals on one line ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | 50 | _ = 'a' "b" -51 | +51 | 52 | _ = rf"a" rf"b" | ^^^^^^^^^^^ ISC001 -53 | +53 | 54 | # Single-line explicit concatenation should be ignored. | = help: Combine string literals diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap index 02d08ef45c..42e5ca2717 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC002_ISC.py.snap @@ -1,16 +1,15 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs -snapshot_kind: text --- ISC.py:5:5: ISC002 Implicitly concatenated string literals over multiple lines | 3 | _ = "abc" + "def" -4 | +4 | 5 | _ = "abc" \ | _____^ 6 | | "def" | |_________^ ISC002 -7 | +7 | 8 | _ = ( | @@ -22,6 +21,6 @@ ISC.py:74:10: ISC002 Implicitly concatenated string literals over multiple lines | __________^ 75 | | f"def"} g" | |__________^ ISC002 -76 | +76 | 77 | # Explicitly concatenated nested f-strings | 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 aab4a381d1..73d16d6ebd 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs -snapshot_kind: text --- ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" | ^^^^^^^ ISC001 -2 | +2 | 3 | _ = "abc" + "def" | = help: Combine string literals @@ -22,7 +21,7 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" | ^^^^^^^ ISC001 -2 | +2 | 3 | _ = "abc" + "def" | = help: Combine string literals @@ -37,10 +36,10 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | 36 | ) -37 | +37 | 38 | _ = """a""" """b""" | ^^^^^^^^^^^^^^^ ISC001 -39 | +39 | 40 | _ = """a | = help: Combine string literals @@ -58,13 +57,13 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | 38 | _ = """a""" """b""" -39 | +39 | 40 | _ = """a | _____^ 41 | | b""" """c 42 | | d""" | |____^ ISC001 -43 | +43 | 44 | _ = f"""a""" f"""b""" | = help: Combine string literals @@ -82,10 +81,10 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | 42 | d""" -43 | +43 | 44 | _ = f"""a""" f"""b""" | ^^^^^^^^^^^^^^^^^ ISC001 -45 | +45 | 46 | _ = f"a" "b" | = help: Combine string literals @@ -103,10 +102,10 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | 44 | _ = f"""a""" f"""b""" -45 | +45 | 46 | _ = f"a" "b" | ^^^^^^^^ ISC001 -47 | +47 | 48 | _ = """a""" "b" | = help: Combine string literals @@ -114,10 +113,10 @@ ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line ISC.py:48:5: ISC001 Implicitly concatenated string literals on one line | 46 | _ = f"a" "b" -47 | +47 | 48 | _ = """a""" "b" | ^^^^^^^^^^^ ISC001 -49 | +49 | 50 | _ = 'a' "b" | = help: Combine string literals @@ -125,10 +124,10 @@ ISC.py:48:5: ISC001 Implicitly concatenated string literals on one line ISC.py:50:5: ISC001 Implicitly concatenated string literals on one line | 48 | _ = """a""" "b" -49 | +49 | 50 | _ = 'a' "b" | ^^^^^^^ ISC001 -51 | +51 | 52 | _ = rf"a" rf"b" | = help: Combine string literals @@ -136,10 +135,10 @@ ISC.py:50:5: ISC001 Implicitly concatenated string literals on one line ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | 50 | _ = 'a' "b" -51 | +51 | 52 | _ = rf"a" rf"b" | ^^^^^^^^^^^ ISC001 -53 | +53 | 54 | # Single-line explicit concatenation should be ignored. | = help: Combine string literals diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap index c53b5a252f..dc6fb55713 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs -snapshot_kind: text --- custom.py:3:8: ICN001 `altair` should be imported as `alt` | 1 | import math # not checked -2 | +2 | 3 | import altair # unconventional | ^^^^^^ ICN001 4 | import dask.array # unconventional @@ -149,7 +148,7 @@ custom.py:16:8: ICN001 `pyarrow` should be imported as `pa` 15 | import polars # unconventional 16 | import pyarrow # unconventional | ^^^^^^^ ICN001 -17 | +17 | 18 | import altair as altr # unconventional | = help: Alias `pyarrow` to `pa` @@ -157,7 +156,7 @@ custom.py:16:8: ICN001 `pyarrow` should be imported as `pa` custom.py:18:18: ICN001 `altair` should be imported as `alt` | 16 | import pyarrow # unconventional -17 | +17 | 18 | import altair as altr # unconventional | ^^^^ ICN001 19 | import matplotlib.pyplot as plot # unconventional @@ -301,7 +300,7 @@ custom.py:31:19: ICN001 `pyarrow` should be imported as `pa` 30 | import polars as ps # unconventional 31 | import pyarrow as arr # unconventional | ^^^ ICN001 -32 | +32 | 33 | import altair as alt # conventional | = help: Alias `pyarrow` to `pa` diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap index 2b2185e495..7559c70440 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs -snapshot_kind: text --- custom_banned.py:1:1: ICN002 `typing` should not be imported as `t` | @@ -14,14 +13,14 @@ custom_banned.py:2:1: ICN002 `typing` should not be imported as `ty` 1 | import typing as t # banned 2 | import typing as ty # banned | ^^^^^^^^^^^^^^^^^^^ ICN002 -3 | +3 | 4 | import numpy as nmp # banned | custom_banned.py:4:1: ICN002 `numpy` should not be imported as `nmp` | 2 | import typing as ty # banned -3 | +3 | 4 | import numpy as nmp # banned | ^^^^^^^^^^^^^^^^^^^ ICN002 5 | import numpy as npy # banned @@ -72,6 +71,6 @@ custom_banned.py:9:1: ICN002 `torch.nn.functional` should not be imported as `F` 8 | from tensorflow.keras import backend as K # banned 9 | from torch.nn import functional as F # banned | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ICN002 -10 | +10 | 11 | from typing import Any # ok | diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap index 0189ad3972..f40db3b4c0 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__custom_banned_from.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs -snapshot_kind: text --- custom_banned_from.py:1:1: ICN003 Members of `logging.config` should not be imported explicitly | @@ -24,14 +23,14 @@ custom_banned_from.py:3:1: ICN003 Members of `typing` should not be imported exp 2 | from typing import Any, Dict # banned 3 | from typing import * # banned | ^^^^^^^^^^^^^^^^^^^^ ICN003 -4 | +4 | 5 | from pandas import DataFrame # banned | custom_banned_from.py:5:1: ICN003 Members of `pandas` should not be imported explicitly | 3 | from typing import * # banned -4 | +4 | 5 | from pandas import DataFrame # banned | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ICN003 6 | from pandas import * # banned @@ -42,6 +41,6 @@ custom_banned_from.py:6:1: ICN003 Members of `pandas` should not be imported exp 5 | from pandas import DataFrame # banned 6 | from pandas import * # banned | ^^^^^^^^^^^^^^^^^^^^ ICN003 -7 | +7 | 8 | import logging.config # ok | diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap index d642e4f281..3cafb07489 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__from_imports.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs -snapshot_kind: text --- from_imports.py:3:8: ICN001 `xml.dom.minidom` should be imported as `md` | @@ -84,7 +83,7 @@ from_imports.py:10:57: ICN001 `xml.dom.minidom.parseString` should be imported a 9 | from xml.dom.minidom import parse, parseString 10 | from xml.dom.minidom import parse as ps, parseString as wrong | ^^^^^ ICN001 -11 | +11 | 12 | # No ICN001 violations | = help: Alias `xml.dom.minidom.parseString` to `pstr` diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap index 16b6eece77..16911e7f22 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__override_defaults.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs -snapshot_kind: text --- override_default.py:3:8: ICN001 `altair` should be imported as `alt` | 1 | import math # not checked -2 | +2 | 3 | import altair # unconventional | ^^^^^^ ICN001 4 | import matplotlib.pyplot # unconventional @@ -50,7 +49,7 @@ override_default.py:7:8: ICN001 `seaborn` should be imported as `sns` 6 | import pandas # unconventional 7 | import seaborn # unconventional | ^^^^^^^ ICN001 -8 | +8 | 9 | import altair as altr # unconventional | = help: Alias `seaborn` to `sns` @@ -58,7 +57,7 @@ override_default.py:7:8: ICN001 `seaborn` should be imported as `sns` override_default.py:9:18: ICN001 `altair` should be imported as `alt` | 7 | import seaborn # unconventional - 8 | + 8 | 9 | import altair as altr # unconventional | ^^^^ ICN001 10 | import matplotlib.pyplot as plot # unconventional @@ -103,7 +102,7 @@ override_default.py:13:19: ICN001 `seaborn` should be imported as `sns` 12 | import pandas as pdas # unconventional 13 | import seaborn as sbrn # unconventional | ^^^^ ICN001 -14 | +14 | 15 | import altair as alt # conventional | = help: Alias `seaborn` to `sns` diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap index 4db12756a0..daf24699fc 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__remove_defaults.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs -snapshot_kind: text --- remove_default.py:3:8: ICN001 `altair` should be imported as `alt` | 1 | import math # not checked -2 | +2 | 3 | import altair # unconventional | ^^^^^^ ICN001 4 | import matplotlib.pyplot # unconventional @@ -39,7 +38,7 @@ remove_default.py:7:8: ICN001 `seaborn` should be imported as `sns` 6 | import pandas # unconventional 7 | import seaborn # unconventional | ^^^^^^^ ICN001 -8 | +8 | 9 | import altair as altr # unconventional | = help: Alias `seaborn` to `sns` @@ -47,7 +46,7 @@ remove_default.py:7:8: ICN001 `seaborn` should be imported as `sns` remove_default.py:9:18: ICN001 `altair` should be imported as `alt` | 7 | import seaborn # unconventional - 8 | + 8 | 9 | import altair as altr # unconventional | ^^^^ ICN001 10 | import matplotlib.pyplot as plot # unconventional @@ -81,7 +80,7 @@ remove_default.py:13:19: ICN001 `seaborn` should be imported as `sns` 12 | import pandas as pdas # unconventional 13 | import seaborn as sbrn # unconventional | ^^^^ ICN001 -14 | +14 | 15 | import altair as alt # conventional | = help: Alias `seaborn` to `sns` 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 e4eea11910..c46ebbc1e5 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs -snapshot_kind: text --- LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | 1 | import logging -2 | +2 | 3 | logging.Logger(__name__) | ^^^^^^^^^^^^^^ LOG001 4 | logging.Logger() 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 58a4e4af4b..25a78dfdb0 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs -snapshot_kind: text --- LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` | @@ -27,7 +26,7 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` 11 | getLogger(__file__) 12 | logging.getLogger(name=__file__) | ^^^^^^^^ LOG002 -13 | +13 | 14 | logging.getLogger(__cached__) | = help: Replace with `__name__` @@ -45,7 +44,7 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | 12 | logging.getLogger(name=__file__) -13 | +13 | 14 | logging.getLogger(__cached__) | ^^^^^^^^^^ LOG002 15 | getLogger(name=__cached__) diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap index c700825d18..b98d744c20 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG007_LOG007.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs -snapshot_kind: text --- LOG007.py:6:1: LOG007 Use of `logging.exception` with falsy `exc_info` | @@ -44,7 +43,7 @@ LOG007.py:10:1: LOG007 Use of `logging.exception` with falsy `exc_info` LOG007.py:17:1: LOG007 Use of `logging.exception` with falsy `exc_info` | 15 | from logging import exception -16 | +16 | 17 | exception("foo", exc_info=False) # LOG007 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LOG007 18 | exception("foo", exc_info=True) # OK 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 1da6b8e358..7d18aeb14e 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs -snapshot_kind: text --- LOG009.py:4:5: LOG009 [*] Use of undocumented `logging.WARN` constant | 2 | import logging -3 | +3 | 4 | logging.WARN # LOG009 | ^^^^^^^^^^^^ LOG009 5 | logging.WARNING # OK @@ -25,7 +24,7 @@ LOG009.py:4:5: LOG009 [*] Use of undocumented `logging.WARN` constant LOG009.py:11:5: LOG009 [*] Use of undocumented `logging.WARN` constant | 9 | from logging import WARN, WARNING -10 | +10 | 11 | WARN # LOG009 | ^^^^ LOG009 12 | WARNING # OK diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG015_LOG015.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG015_LOG015.py.snap index 717549285d..6c22e8d998 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG015_LOG015.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG015_LOG015.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs -snapshot_kind: text --- LOG015.py:4:1: LOG015 `debug()` call on root logger | 2 | import logging -3 | +3 | 4 | logging.debug("Lorem") | ^^^^^^^^^^^^^^^^^^^^^^ LOG015 5 | logging.info("ipsum") @@ -89,7 +88,7 @@ LOG015.py:11:1: LOG015 `exception()` call on root logger LOG015.py:26:1: LOG015 `debug()` call on root logger | 24 | ) -25 | +25 | 26 | debug("Lorem") | ^^^^^^^^^^^^^^ LOG015 27 | info("ipsum") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap index 2eec8bb3ba..a872a12c9d 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G001.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G001.py:4:14: G001 Logging statement uses `str.format` | 2 | import logging as foo -3 | +3 | 4 | logging.info("Hello {}".format("World!")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ G001 5 | logging.log(logging.INFO, "Hello {}".format("World!")) @@ -56,14 +55,14 @@ G001.py:9:17: G001 Logging statement uses `str.format` 8 | logging.log(level=logging.INFO, msg="Hello {}".format("World!")) 9 | logging.log(msg="Hello {}".format("World!"), level=logging.INFO) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ G001 -10 | +10 | 11 | # Flask support | G001.py:16:31: G001 Logging statement uses `str.format` | 14 | from flask import current_app as app -15 | +15 | 16 | flask.current_app.logger.info("Hello {}".format("World!")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ G001 17 | current_app.logger.info("Hello {}".format("World!")) @@ -84,14 +83,14 @@ G001.py:18:30: G001 Logging statement uses `str.format` 17 | current_app.logger.info("Hello {}".format("World!")) 18 | app.logger.log(logging.INFO, "Hello {}".format("World!")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ G001 -19 | +19 | 20 | from logging import info, log | G001.py:22:6: G001 Logging statement uses `str.format` | 20 | from logging import info, log -21 | +21 | 22 | info("Hello {}".format("World!")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ G001 23 | log(logging.INFO, "Hello {}".format("World!")) diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap index 4867dc9276..ac9571bbc3 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G002.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G002.py:3:14: G002 Logging statement uses `%` | 1 | import logging -2 | +2 | 3 | logging.info("Hello %s" % "World!") | ^^^^^^^^^^^^^^^^^^^^^ G002 4 | logging.log(logging.INFO, "Hello %s" % "World!") @@ -16,14 +15,14 @@ G002.py:4:27: G002 Logging statement uses `%` 3 | logging.info("Hello %s" % "World!") 4 | logging.log(logging.INFO, "Hello %s" % "World!") | ^^^^^^^^^^^^^^^^^^^^^ G002 -5 | +5 | 6 | from logging import info, log | G002.py:8:6: G002 Logging statement uses `%` | 6 | from logging import info, log -7 | +7 | 8 | info("Hello %s" % "World!") | ^^^^^^^^^^^^^^^^^^^^^ G002 9 | log(logging.INFO, "Hello %s" % "World!") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap index 28c83697c6..431d5dbf32 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G003.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G003.py:3:14: G003 Logging statement uses `+` | 1 | import logging -2 | +2 | 3 | logging.info("Hello" + " " + "World!") | ^^^^^^^^^^^^^^^^^^^^^^^^ G003 4 | logging.log(logging.INFO, "Hello" + " " + "World!") @@ -16,14 +15,14 @@ G003.py:4:27: G003 Logging statement uses `+` 3 | logging.info("Hello" + " " + "World!") 4 | logging.log(logging.INFO, "Hello" + " " + "World!") | ^^^^^^^^^^^^^^^^^^^^^^^^ G003 -5 | +5 | 6 | from logging import info, log | G003.py:8:6: G003 Logging statement uses `+` | 6 | from logging import info, log -7 | +7 | 8 | info("Hello" + " " + "World!") | ^^^^^^^^^^^^^^^^^^^^^^^^ G003 9 | log(logging.INFO, "Hello" + " " + "World!") diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap index 41f4929b78..9cd4524dd9 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G004.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G004.py:4:14: G004 Logging statement uses f-string | @@ -16,7 +15,7 @@ G004.py:5:27: G004 Logging statement uses f-string 4 | logging.info(f"Hello {name}") 5 | logging.log(logging.INFO, f"Hello {name}") | ^^^^^^^^^^^^^^^ G004 -6 | +6 | 7 | _LOGGER = logging.getLogger() | @@ -25,24 +24,24 @@ G004.py:8:14: G004 Logging statement uses f-string 7 | _LOGGER = logging.getLogger() 8 | _LOGGER.info(f"{__name__}") | ^^^^^^^^^^^^^ G004 - 9 | + 9 | 10 | logging.getLogger().info(f"{name}") | G004.py:10:26: G004 Logging statement uses f-string | 8 | _LOGGER.info(f"{__name__}") - 9 | + 9 | 10 | logging.getLogger().info(f"{name}") | ^^^^^^^^^ G004 -11 | +11 | 12 | from logging import info | G004.py:14:6: G004 Logging statement uses f-string | 12 | from logging import info -13 | +13 | 14 | info(f"{name}") | ^^^^^^^^^ G004 15 | info(f"{__name__}") 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 a35bf737c4..f746582a16 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning` | 4 | from logging_setup import logger -5 | +5 | 6 | logging.warn("Hello World!") | ^^^^ G010 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate @@ -29,7 +28,7 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate 8 | logger.warn("Hello world!") | ^^^^ G010 - 9 | + 9 | 10 | logging . warn("Hello World!") | = help: Convert to `warning` @@ -47,10 +46,10 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` | 8 | logger.warn("Hello world!") - 9 | + 9 | 10 | logging . warn("Hello World!") | ^^^^ G010 -11 | +11 | 12 | from logging import warn, warning, exception | = help: Convert to `warning` diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap index abc5d867f9..62ce1845b6 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G201.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G201.py:8:13: G201 Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)` | @@ -8,7 +7,7 @@ G201.py:8:13: G201 Logging `.exception(...)` should be used instead of `.error(. 7 | except: 8 | logging.error("Hello World", exc_info=True) | ^^^^^ G201 - 9 | + 9 | 10 | try: | @@ -18,7 +17,7 @@ G201.py:13:13: G201 Logging `.exception(...)` should be used instead of `.error( 12 | except: 13 | logging.error("Hello World", exc_info=sys.exc_info()) | ^^^^^ G201 -14 | +14 | 15 | # OK | @@ -28,7 +27,7 @@ G201.py:28:5: G201 Logging `.exception(...)` should be used instead of `.error(. 27 | except: 28 | error("Hello World", exc_info=True) | ^^^^^ G201 -29 | +29 | 30 | try: | @@ -38,6 +37,6 @@ G201.py:33:5: G201 Logging `.exception(...)` should be used instead of `.error(. 32 | except: 33 | error("Hello World", exc_info=sys.exc_info()) | ^^^^^ G201 -34 | +34 | 35 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap index 8a76df5965..fa50225852 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G202.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_logging_format/mod.rs -snapshot_kind: text --- G202.py:8:38: G202 Logging statement has redundant `exc_info` | @@ -8,7 +7,7 @@ G202.py:8:38: G202 Logging statement has redundant `exc_info` 7 | except: 8 | logging.exception("Hello World", exc_info=True) | ^^^^^^^^^^^^^ G202 - 9 | + 9 | 10 | try: | @@ -18,7 +17,7 @@ G202.py:13:38: G202 Logging statement has redundant `exc_info` 12 | except: 13 | logging.exception("Hello World", exc_info=sys.exc_info()) | ^^^^^^^^^^^^^^^^^^^^^^^ G202 -14 | +14 | 15 | # OK | @@ -28,7 +27,7 @@ G202.py:28:30: G202 Logging statement has redundant `exc_info` 27 | except: 28 | exception("Hello World", exc_info=True) | ^^^^^^^^^^^^^ G202 -29 | +29 | 30 | try: | @@ -38,6 +37,6 @@ G202.py:33:30: G202 Logging statement has redundant `exc_info` 32 | except: 33 | exception("Hello World", exc_info=sys.exc_info()) | ^^^^^^^^^^^^^^^^^^^^^^^ G202 -34 | +34 | 35 | # OK | 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 bda688be36..8fcca36699 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs -snapshot_kind: text --- PIE790.py:4:5: PIE790 [*] Unnecessary `pass` statement | 2 | """buzz""" -3 | +3 | 4 | pass | ^^^^ PIE790 | @@ -132,7 +131,7 @@ PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement | 48 | """ -49 | +49 | 50 | pass | ^^^^ PIE790 | @@ -150,7 +149,7 @@ PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement | 56 | """ -57 | +57 | 58 | pass | ^^^^ PIE790 | @@ -209,7 +208,7 @@ PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement 78 | """buzz""" 79 | pass | ^^^^ PIE790 -80 | +80 | 81 | async for _ in range(10): | = help: Remove unnecessary `pass` @@ -229,7 +228,7 @@ PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement 82 | """buzz""" 83 | pass | ^^^^ PIE790 -84 | +84 | 85 | while cond: | = help: Remove unnecessary `pass` @@ -267,7 +266,7 @@ PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement 91 | """buzz""" 92 | pass | ^^^^ PIE790 -93 | +93 | 94 | async with bar: | = help: Remove unnecessary `pass` @@ -378,7 +377,7 @@ PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement 140 | pass 141 | pass | ^^^^ PIE790 -142 | +142 | 143 | for i in range(10): | = help: Remove unnecessary `pass` @@ -397,7 +396,7 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement 143 | for i in range(10): 144 | pass | ^^^^ PIE790 -145 | +145 | 146 | pass | = help: Remove unnecessary `pass` @@ -414,10 +413,10 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement | 144 | pass -145 | +145 | 146 | pass | ^^^^ PIE790 -147 | +147 | 148 | for i in range(10): | = help: Remove unnecessary `pass` @@ -528,7 +527,7 @@ PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal 165 | ... 166 | ... | ^^^ PIE790 -167 | +167 | 168 | for i in range(10): | = help: Remove unnecessary `...` @@ -547,7 +546,7 @@ PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal 168 | for i in range(10): 169 | ... | ^^^ PIE790 -170 | +170 | 171 | ... | = help: Remove unnecessary `...` @@ -564,10 +563,10 @@ PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal | 169 | ... -170 | +170 | 171 | ... | ^^^ PIE790 -172 | +172 | 173 | for i in range(10): | = help: Remove unnecessary `...` @@ -606,7 +605,7 @@ PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal 174 | ... # comment 175 | ... | ^^^ PIE790 -176 | +176 | 177 | for i in range(10): | = help: Remove unnecessary `...` @@ -644,7 +643,7 @@ PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement 178 | ... 179 | pass | ^^^^ PIE790 -180 | +180 | 181 | from typing import Protocol | = help: Remove unnecessary `pass` 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 38c05b1b79..3e6e4df3d5 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs -snapshot_kind: text --- PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times | @@ -8,7 +7,7 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times 3 | # .... 4 | name = StringField() # PIE794 | ^^^^^^^^^^^^^^^^^^^^ PIE794 -5 | +5 | 6 | def remove(self) -> None: | = help: Remove duplicate field definition for `name` @@ -28,7 +27,7 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times 12 | # .... 13 | name = StringField() # PIE794 | ^^^^^^^^^^^^^^^^^^^^ PIE794 -14 | +14 | 15 | def foo(self) -> None: | = help: Remove duplicate field definition for `name` diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap index e63cf00f6a..65449396c0 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs -snapshot_kind: text --- PIE800.py:1:14: PIE800 [*] Unnecessary spread `**` | 1 | {"foo": 1, **{"bar": 1}} # PIE800 | ^^^^^^^^^^ PIE800 -2 | +2 | 3 | {**{"bar": 10}, "a": "b"} # PIE800 | = help: Remove unnecessary dict @@ -14,69 +13,69 @@ PIE800.py:1:14: PIE800 [*] Unnecessary spread `**` ℹ Safe fix 1 |-{"foo": 1, **{"bar": 1}} # PIE800 1 |+{"foo": 1, "bar": 1} # PIE800 -2 2 | +2 2 | 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 -4 4 | +4 4 | PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` | 1 | {"foo": 1, **{"bar": 1}} # PIE800 -2 | +2 | 3 | {**{"bar": 10}, "a": "b"} # PIE800 | ^^^^^^^^^^^ PIE800 -4 | +4 | 5 | foo({**foo, **{"bar": True}}) # PIE800 | = help: Remove unnecessary dict ℹ Safe fix 1 1 | {"foo": 1, **{"bar": 1}} # PIE800 -2 2 | +2 2 | 3 |-{**{"bar": 10}, "a": "b"} # PIE800 3 |+{"bar": 10, "a": "b"} # PIE800 -4 4 | +4 4 | 5 5 | foo({**foo, **{"bar": True}}) # PIE800 -6 6 | +6 6 | PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` | 3 | {**{"bar": 10}, "a": "b"} # PIE800 -4 | +4 | 5 | foo({**foo, **{"bar": True}}) # PIE800 | ^^^^^^^^^^^^^ PIE800 -6 | +6 | 7 | {**foo, **{"bar": 10}} # PIE800 | = help: Remove unnecessary dict ℹ Safe fix -2 2 | +2 2 | 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 -4 4 | +4 4 | 5 |-foo({**foo, **{"bar": True}}) # PIE800 5 |+foo({**foo, "bar": True}) # PIE800 -6 6 | +6 6 | 7 7 | {**foo, **{"bar": 10}} # PIE800 -8 8 | +8 8 | PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` | 5 | foo({**foo, **{"bar": True}}) # PIE800 -6 | +6 | 7 | {**foo, **{"bar": 10}} # PIE800 | ^^^^^^^^^^^ PIE800 -8 | +8 | 9 | { # PIE800 | = help: Remove unnecessary dict ℹ Safe fix -4 4 | +4 4 | 5 5 | foo({**foo, **{"bar": True}}) # PIE800 -6 6 | +6 6 | 7 |-{**foo, **{"bar": 10}} # PIE800 7 |+{**foo, "bar": 10} # PIE800 -8 8 | +8 8 | 9 9 | { # PIE800 10 10 | "a": "b", @@ -100,7 +99,7 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` 10 10 | "a": "b", 11 11 | # Preserve 12 |- **{ - 12 |+ + 12 |+ 13 13 | # all 14 |- "bar": 10, # the 14 |+ "bar": 10 # the @@ -108,16 +107,16 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` 16 |- }, 16 |+ , 17 17 | } -18 18 | +18 18 | 19 19 | {**foo, **buzz, **{bar: 10}} # PIE800 PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` | 17 | } -18 | +18 | 19 | {**foo, **buzz, **{bar: 10}} # PIE800 | ^^^^^^^^^ PIE800 -20 | +20 | 21 | # https://github.com/astral-sh/ruff/issues/15366 | = help: Remove unnecessary dict @@ -125,10 +124,10 @@ PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` ℹ Safe fix 16 16 | }, 17 17 | } -18 18 | +18 18 | 19 |-{**foo, **buzz, **{bar: 10}} # PIE800 19 |+{**foo, **buzz, bar: 10} # PIE800 -20 20 | +20 20 | 21 21 | # https://github.com/astral-sh/ruff/issues/15366 22 22 | { @@ -149,7 +148,7 @@ PIE800.py:24:8: PIE800 [*] Unnecessary spread `**` 24 |- **({"count": 1 if include_count else {}}), 24 |+ "count": 1 if include_count else {}, 25 25 | } -26 26 | +26 26 | 27 27 | { PIE800.py:30:9: PIE800 [*] Unnecessary spread `**` @@ -165,7 +164,7 @@ PIE800.py:30:9: PIE800 [*] Unnecessary spread `**` = help: Remove unnecessary dict ℹ Safe fix -26 26 | +26 26 | 27 27 | { 28 28 | "data": [], 29 |- **( # Comment @@ -175,7 +174,7 @@ PIE800.py:30:9: PIE800 [*] Unnecessary spread `**` 30 |+ # Comment 31 |+ "count": 1 if include_count else {}, 32 32 | } -33 33 | +33 33 | 34 34 | { PIE800.py:37:9: PIE800 [*] Unnecessary spread `**` @@ -191,17 +190,17 @@ PIE800.py:37:9: PIE800 [*] Unnecessary spread `**` = help: Remove unnecessary dict ℹ Safe fix -33 33 | +33 33 | 34 34 | { 35 35 | "data": [], 36 |- **( 37 |- { 38 |- "count": (a := 1),}), - 36 |+ - 37 |+ + 36 |+ + 37 |+ 38 |+ "count": (a := 1), 39 39 | } -40 40 | +40 40 | 41 41 | { PIE800.py:44:9: PIE800 [*] Unnecessary spread `**` @@ -219,21 +218,21 @@ PIE800.py:44:9: PIE800 [*] Unnecessary spread `**` = help: Remove unnecessary dict ℹ Safe fix -40 40 | +40 40 | 41 41 | { 42 42 | "data": [], 43 |- **( 44 |- { - 43 |+ - 44 |+ + 43 |+ + 44 |+ 45 45 | "count": (a := 1) 46 |- } 47 |- ) - 46 |+ - 47 |+ + 46 |+ + 47 |+ 48 48 | , 49 49 | } -50 50 | +50 50 | PIE800.py:54:9: PIE800 [*] Unnecessary spread `**` | @@ -250,7 +249,7 @@ PIE800.py:54:9: PIE800 [*] Unnecessary spread `**` = help: Remove unnecessary dict ℹ Safe fix -50 50 | +50 50 | 51 51 | { 52 52 | "data": [], 53 |- **( @@ -258,14 +257,14 @@ PIE800.py:54:9: PIE800 [*] Unnecessary spread `**` 55 |- "count": (a := 1), # Comment 56 |- } # Comment 57 |- ) # Comment - 53 |+ - 54 |+ + 53 |+ + 54 |+ 55 |+ "count": (a := 1) # Comment 56 |+ # Comment 57 |+ # Comment 58 58 | , 59 59 | } -60 60 | +60 60 | PIE800.py:65:1: PIE800 [*] Unnecessary spread `**` | @@ -281,7 +280,7 @@ PIE800.py:65:1: PIE800 [*] Unnecessary spread `**` = help: Remove unnecessary dict ℹ Safe fix -60 60 | +60 60 | 61 61 | ({ 62 62 | "data": [], 63 |- **( # Comment @@ -296,7 +295,7 @@ PIE800.py:65:1: PIE800 [*] Unnecessary spread `**` 65 |+ # Comment 66 |+ "count": (a := 1) # Comment 67 |+ # Comment - 68 |+ + 68 |+ 69 |+ # Comment 70 70 | , 71 71 | }) 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 0e21639f56..b26502fe8c 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs -snapshot_kind: text --- PIE804.py:1:5: PIE804 [*] Unnecessary `dict` kwargs | 1 | foo(**{"bar": True}) # PIE804 | ^^^^^^^^^^^^^^^ PIE804 -2 | +2 | 3 | foo(**{"r2d2": True}) # PIE804 | = help: Remove unnecessary kwargs @@ -21,10 +20,10 @@ PIE804.py:1:5: PIE804 [*] Unnecessary `dict` kwargs PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs | 1 | foo(**{"bar": True}) # PIE804 -2 | +2 | 3 | foo(**{"r2d2": True}) # PIE804 | ^^^^^^^^^^^^^^^^ PIE804 -4 | +4 | 5 | Foo.objects.create(**{"bar": True}) # PIE804 | = help: Remove unnecessary kwargs @@ -41,10 +40,10 @@ PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs | 3 | foo(**{"r2d2": True}) # PIE804 -4 | +4 | 5 | Foo.objects.create(**{"bar": True}) # PIE804 | ^^^^^^^^^^^^^^^ PIE804 -6 | +6 | 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 | = help: Remove unnecessary kwargs @@ -62,10 +61,10 @@ PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs | 5 | Foo.objects.create(**{"bar": True}) # PIE804 -6 | +6 | 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 | ^^^^^^^^^^^^^^^^^^ PIE804 -8 | +8 | 9 | Foo.objects.create(**{**bar}) # PIE804 | = help: Remove unnecessary kwargs @@ -83,10 +82,10 @@ PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs | 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 - 8 | + 8 | 9 | Foo.objects.create(**{**bar}) # PIE804 | ^^^^^^^^^ PIE804 -10 | +10 | 11 | foo(**{}) | = help: Remove unnecessary kwargs @@ -104,10 +103,10 @@ PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs | 9 | Foo.objects.create(**{**bar}) # PIE804 -10 | +10 | 11 | foo(**{}) | ^^^^ PIE804 -12 | +12 | 13 | foo(**{**data, "foo": "buzz"}) | = help: Remove unnecessary kwargs @@ -128,7 +127,7 @@ PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs 21 | abc(**{"for": 3}) 22 | foo(**{},) | ^^^^ PIE804 -23 | +23 | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. | = help: Remove unnecessary kwargs @@ -167,7 +166,7 @@ PIE804.py:26:10: PIE804 Unnecessary `dict` kwargs 25 | abc(**{'a': b}, **{'a': c}) # PIE804 26 | abc(a=1, **{'a': c}, **{'b': c}) # PIE804 | ^^^^^^^^^^ PIE804 -27 | +27 | 28 | # Some values need to be parenthesized. | = help: Remove unnecessary kwargs @@ -178,7 +177,7 @@ PIE804.py:26:22: PIE804 [*] Unnecessary `dict` kwargs 25 | abc(**{'a': b}, **{'a': c}) # PIE804 26 | abc(a=1, **{'a': c}, **{'b': c}) # PIE804 | ^^^^^^^^^^ PIE804 -27 | +27 | 28 | # Some values need to be parenthesized. | = help: Remove unnecessary kwargs 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 ada350d109..86f5cb6332 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs -snapshot_kind: text --- PIE808.py:2:7: PIE808 [*] Unnecessary `start` argument in `range` | 1 | # PIE808 2 | range(0, 10) | ^ PIE808 -3 | +3 | 4 | import builtins | = help: Remove `start` argument @@ -25,7 +24,7 @@ PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` 4 | import builtins 5 | builtins.range(0, 10) | ^ PIE808 -6 | +6 | 7 | # OK | = help: Remove `start` argument 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 1084393b53..8a23e3ea53 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs -snapshot_kind: text --- PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` | @@ -89,7 +88,7 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` 9 | # error 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PIE810 -11 | +11 | 12 | def func(): | = help: Merge into a single `startswith` call @@ -107,7 +106,7 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` | 17 | z = "w" -18 | +18 | 19 | if msg.startswith(x) or msg.startswith(y) or msg.startswith(z): # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PIE810 20 | print("yes") @@ -127,7 +126,7 @@ PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` | 23 | msg = "hello world" -24 | +24 | 25 | if msg.startswith(("h", "e", "l", "l", "o")) or msg.startswith("h") or msg.startswith("w"): # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PIE810 26 | print("yes") diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap index 140a3a2f30..3177ee0830 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_print/mod.rs -snapshot_kind: text --- T201.py:4:1: T201 [*] `print` found | 2 | import tempfile -3 | +3 | 4 | print("Hello, world!") # T201 | ^^^^^ T201 5 | print("Hello, world!", file=None) # T201 @@ -66,7 +65,7 @@ T201.py:7:1: T201 [*] `print` found 6 | print("Hello, world!", file=sys.stdout) # T201 7 | print("Hello, world!", file=sys.stderr) # T201 | ^^^^^ T201 -8 | +8 | 9 | with tempfile.NamedTemporaryFile() as fp: | = help: Remove `print` diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap index 72436e2483..24d4d7193d 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_print/mod.rs -snapshot_kind: text --- T203.py:3:1: T203 [*] `pprint` found | 1 | from pprint import pprint -2 | +2 | 3 | pprint("Hello, world!") # T203 | ^^^^^^ T203 -4 | +4 | 5 | import pprint | = help: Remove `pprint` @@ -24,10 +23,10 @@ T203.py:3:1: T203 [*] `pprint` found T203.py:7:1: T203 [*] `pprint` found | 5 | import pprint -6 | +6 | 7 | pprint.pprint("Hello, world!") # T203 | ^^^^^^^^^^^^^ T203 -8 | +8 | 9 | pprint.pformat("Hello, world!") | = help: Remove `pprint` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap index b692edd277..d612aa2103 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI001_PYI001.pyi.snap @@ -1,33 +1,32 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI001.pyi:3:5: PYI001 Name of private `TypeVar` must start with `_` | 1 | from typing import ParamSpec, TypeVar, TypeVarTuple -2 | +2 | 3 | T = TypeVar("T") # Error: TypeVars in stubs must start with _ | ^^^^^^^^^^^^ PYI001 -4 | +4 | 5 | TTuple = TypeVarTuple("TTuple") # Error: TypeVarTuples must also start with _ | PYI001.pyi:5:10: PYI001 Name of private `TypeVarTuple` must start with `_` | 3 | T = TypeVar("T") # Error: TypeVars in stubs must start with _ -4 | +4 | 5 | TTuple = TypeVarTuple("TTuple") # Error: TypeVarTuples must also start with _ | ^^^^^^^^^^^^^^^^^^^^^^ PYI001 -6 | +6 | 7 | P = ParamSpec("P") # Error: ParamSpecs must start with _ | PYI001.pyi:7:5: PYI001 Name of private `ParamSpec` must start with `_` | 5 | TTuple = TypeVarTuple("TTuple") # Error: TypeVarTuples must also start with _ -6 | +6 | 7 | P = ParamSpec("P") # Error: ParamSpecs must start with _ | ^^^^^^^^^^^^^^ PYI001 -8 | +8 | 9 | _T = TypeVar("_T") # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap index c56b6522bb..7b018399ca 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI002_PYI002.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI002.pyi:3:4: PYI002 `if` test must be a simple comparison against `sys.platform` or `sys.version_info` | 1 | import sys -2 | +2 | 3 | if sys.version == 'Python 2.7.10': ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI002 4 | if 'linux' == sys.platform: ... # Y002 If test must be a simple comparison against sys.platform or sys.version_info diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap index d0c82f0eae..81182425c2 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI004_PYI004.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI004.pyi:4:4: PYI004 Version comparison must use only major and minor version | 2 | from sys import version_info -3 | +3 | 4 | if sys.version_info >= (3, 4, 3): ... # PYI004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI004 5 | if sys.version_info < (3, 4, 3): ... # PYI004 @@ -36,6 +35,6 @@ PYI004.pyi:7:4: PYI004 Version comparison must use only major and minor version 6 | if sys.version_info == (3, 4, 3): ... # PYI004 7 | if sys.version_info != (3, 4, 3): ... # PYI004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI004 -8 | +8 | 9 | if sys.version_info[0] == 2: ... | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap index 24382f3628..117c684948 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI005_PYI005.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI005.pyi:4:4: PYI005 Version comparison must be against a length-1 tuple | 2 | from sys import platform, version_info -3 | +3 | 4 | if sys.version_info[:1] == (2, 7): ... # Y005 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI005 5 | if sys.version_info[:2] == (2,): ... # Y005 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.py.snap index a5f79c0998..93cd183f24 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.py.snap @@ -1,51 +1,50 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI006.py:8:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 6 | if sys.version_info >= (3, 9): ... # OK - 7 | + 7 | 8 | if sys.version_info == (3, 9): ... # OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 - 9 | + 9 | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.py:10:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 8 | if sys.version_info == (3, 9): ... # OK - 9 | + 9 | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -11 | +11 | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.py:12:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -11 | +11 | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -13 | +13 | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.py:14:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -13 | +13 | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -15 | +15 | 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.py:16:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -15 | +15 | 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons @@ -56,14 +55,14 @@ PYI006.py:17:6: PYI006 Use `<` or `>=` for `sys.version_info` comparisons 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -18 | +18 | 19 | if python_version > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.py:19:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -18 | +18 | 19 | if python_version > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 20 | elif python_version == (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap index 2ff61307f9..afe447cc76 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI006_PYI006.pyi.snap @@ -1,51 +1,50 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI006.pyi:8:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 6 | if sys.version_info >= (3, 9): ... # OK - 7 | + 7 | 8 | if sys.version_info == (3, 9): ... # OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 - 9 | + 9 | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.pyi:10:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 8 | if sys.version_info == (3, 9): ... # OK - 9 | + 9 | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -11 | +11 | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.pyi:12:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 10 | if sys.version_info == (3, 9): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -11 | +11 | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -13 | +13 | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.pyi:14:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 12 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -13 | +13 | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -15 | +15 | 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.pyi:16:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 14 | if sys.version_info <= (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -15 | +15 | 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons @@ -56,14 +55,14 @@ PYI006.pyi:17:6: PYI006 Use `<` or `>=` for `sys.version_info` comparisons 16 | if sys.version_info > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 -18 | +18 | 19 | if python_version > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | PYI006.pyi:19:4: PYI006 Use `<` or `>=` for `sys.version_info` comparisons | 17 | elif sys.version_info > (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons -18 | +18 | 19 | if python_version > (3, 10): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons | ^^^^^^^^^^^^^^^^^^^^^^^^ PYI006 20 | elif python_version == (3, 11): ... # Error: PYI006 Use only `<` and `>=` for version info comparisons diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap index 1a8efc3409..bb46b48b79 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI007_PYI007.pyi.snap @@ -1,31 +1,30 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI007.pyi:7:4: PYI007 Unrecognized `sys.platform` check | 5 | if sys.platform != "platform_name_2": ... # OK -6 | +6 | 7 | if sys.platform in ["linux"]: ... # Error: PYI007 Unrecognized sys.platform check | ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI007 -8 | +8 | 9 | if sys.platform > 3: ... # Error: PYI007 Unrecognized sys.platform check | PYI007.pyi:9:4: PYI007 Unrecognized `sys.platform` check | 7 | if sys.platform in ["linux"]: ... # Error: PYI007 Unrecognized sys.platform check - 8 | + 8 | 9 | if sys.platform > 3: ... # Error: PYI007 Unrecognized sys.platform check | ^^^^^^^^^^^^^^^^ PYI007 -10 | +10 | 11 | if sys.platform == 10.12: ... # Error: PYI007 Unrecognized sys.platform check | PYI007.pyi:11:4: PYI007 Unrecognized `sys.platform` check | 9 | if sys.platform > 3: ... # Error: PYI007 Unrecognized sys.platform check -10 | +10 | 11 | if sys.platform == 10.12: ... # Error: PYI007 Unrecognized sys.platform check | ^^^^^^^^^^^^^^^^^^^^^ PYI007 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap index 7ce6c888f6..4e8588c7a3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI008_PYI008.pyi.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI008.pyi:3:20: PYI008 Unrecognized platform `linus` | 1 | import sys -2 | +2 | 3 | if sys.platform == "linus": ... # Error: PYI008 Unrecognized platform `linus` | ^^^^^^^ PYI008 -4 | +4 | 5 | if sys.platform != "linux": ... # OK | 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 20aad76466..48db875d89 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI009.pyi:3:5: PYI009 [*] Empty body should contain `...`, not `pass` | @@ -8,7 +7,7 @@ PYI009.pyi:3:5: PYI009 [*] Empty body should contain `...`, not `pass` 2 | def foo(): 3 | pass # ERROR PYI009, since we're in a stub file | ^^^^ PYI009 -4 | +4 | 5 | class Bar: ... # OK | = help: Replace `pass` with `...` 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 b70e93d11b..a24482573d 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` | 5 | def buzz(): 6 | print("buzz") # ERROR PYI010 | ^^^^^^^^^^^^^ PYI010 -7 | +7 | 8 | def foo2(): | = help: Replace function body with `...` @@ -27,7 +26,7 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` 8 | def foo2(): 9 | 123 # ERROR PYI010 | ^^^ PYI010 -10 | +10 | 11 | def bizz(): | = help: Replace function body with `...` @@ -47,7 +46,7 @@ PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` 11 | def bizz(): 12 | x = 123 # ERROR PYI010 | ^^^^^^^ PYI010 -13 | +13 | 14 | def foo3(): | = help: Replace function body with `...` 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 dd47bc25a8..580d853e1f 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI012.pyi:5:5: PYI012 [*] Class body must not contain `pass` | @@ -8,7 +7,7 @@ PYI012.pyi:5:5: PYI012 [*] Class body must not contain `pass` 4 | value: int 5 | pass # PYI012 Class body must not contain `pass` | ^^^^ PYI012 -6 | +6 | 7 | class OneAttributeClassRev: | = help: Remove unnecessary `pass` @@ -43,10 +42,10 @@ PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` | 14 | """ -15 | +15 | 16 | pass # PYI012 Class body must not contain `pass` | ^^^^ PYI012 -17 | +17 | 18 | class NonEmptyChild(Exception): | = help: Remove unnecessary `pass` @@ -66,7 +65,7 @@ PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` 19 | value: int 20 | pass # PYI012 Class body must not contain `pass` | ^^^^ PYI012 -21 | +21 | 22 | class NonEmptyChild2(Exception): | = help: Remove unnecessary `pass` @@ -104,7 +103,7 @@ PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` 27 | value: int 28 | pass # PYI012 Class body must not contain `pass` | ^^^^ PYI012 -29 | +29 | 30 | def __init__(): | = help: Remove unnecessary `pass` 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 50855dac19..d76266722e 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI013.py:3:5: PYI013 [*] Non-empty class body must not contain `...` | @@ -76,7 +75,7 @@ PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` | 19 | """ -20 | +20 | 21 | ... | ^^^ PYI013 | @@ -133,7 +132,7 @@ PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` 35 | value: int 36 | ... | ^^^ PYI013 -37 | +37 | 38 | def __init__(): | = help: Remove unnecessary `...` 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 c33018dabc..3fc5a71eb4 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI013.pyi:5:5: PYI013 [*] Non-empty class body must not contain `...` | @@ -8,7 +7,7 @@ PYI013.pyi:5:5: PYI013 [*] Non-empty class body must not contain `...` 4 | value: int 5 | ... # Error | ^^^ PYI013 -6 | +6 | 7 | class OneAttributeClass2: | = help: Remove unnecessary `...` @@ -82,7 +81,7 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` 16 | ... 17 | ... # Error | ^^^ PYI013 -18 | +18 | 19 | class DocstringClass: | = help: Remove unnecessary `...` @@ -99,10 +98,10 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` | 22 | """ -23 | +23 | 24 | ... # Error | ^^^ PYI013 -25 | +25 | 26 | class NonEmptyChild(Exception): | = help: Remove unnecessary `...` @@ -122,7 +121,7 @@ PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` 27 | value: int 28 | ... # Error | ^^^ PYI013 -29 | +29 | 30 | class NonEmptyChild2(Exception): | = help: Remove unnecessary `...` @@ -160,7 +159,7 @@ PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` 35 | value: int 36 | ... # Error | ^^^ PYI013 -37 | +37 | 38 | def __init__(): | = help: Remove unnecessary `...` 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 8aa3d8f983..120743179f 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments | @@ -216,7 +215,7 @@ PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments | ^^^^^ PYI015 -56 | +56 | 57 | # We shouldn't emit Y015 within functions | = help: Replace default value with `...` 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 0310bb7b2c..2133baee9e 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI016.py:7:15: PYI016 [*] Duplicate union member `str` | @@ -884,7 +883,7 @@ PYI016.py:113:61: PYI016 [*] Duplicate union member `list[int]` 112 | # Test case for mixed union type 113 | field34: typing.Union[list[int], str] | typing.Union[bytes, list[int]] # Error | ^^^^^^^^^ PYI016 -114 | +114 | 115 | field35: "int | str | int" # Error | = help: Remove duplicate union member `list[int]` @@ -902,7 +901,7 @@ PYI016.py:113:61: PYI016 [*] Duplicate union member `list[int]` PYI016.py:115:23: PYI016 [*] Duplicate union member `int` | 113 | field34: typing.Union[list[int], str] | typing.Union[bytes, list[int]] # Error -114 | +114 | 115 | field35: "int | str | int" # Error | ^^^ PYI016 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap index ad32ef1706..5bc3532bab 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI017_PYI017.pyi.snap @@ -1,43 +1,42 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI017.pyi:4:1: PYI017 Stubs should not contain assignments to attributes or multiple targets | 2 | a = var # OK -3 | +3 | 4 | b = c = int # PYI017 | ^^^^^^^^^^^ PYI017 -5 | +5 | 6 | a.b = int # PYI017 | PYI017.pyi:6:1: PYI017 Stubs should not contain assignments to attributes or multiple targets | 4 | b = c = int # PYI017 -5 | +5 | 6 | a.b = int # PYI017 | ^^^^^^^^^ PYI017 -7 | +7 | 8 | d, e = int, str # PYI017 | PYI017.pyi:8:1: PYI017 Stubs should not contain assignments to attributes or multiple targets | 6 | a.b = int # PYI017 - 7 | + 7 | 8 | d, e = int, str # PYI017 | ^^^^^^^^^^^^^^^ PYI017 - 9 | + 9 | 10 | f, g, h = int, str, TypeVar("T") # PYI017 | PYI017.pyi:10:1: PYI017 Stubs should not contain assignments to attributes or multiple targets | 8 | d, e = int, str # PYI017 - 9 | + 9 | 10 | f, g, h = int, str, TypeVar("T") # PYI017 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI017 -11 | +11 | 12 | i: TypeAlias = int | str # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap index 48ad913ae5..34a9c3305a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI018.py:6:1: PYI018 Private TypeVar `_T` is never used | 4 | from typing_extensions import ParamSpec, TypeVarTuple -5 | +5 | 6 | _T = typing.TypeVar("_T") | ^^ PYI018 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") @@ -46,6 +45,6 @@ PYI018.py:10:1: PYI018 Private TypeVarTuple `_Ts2` is never used 9 | _P2 = typing.ParamSpec("_P2") 10 | _Ts2 = TypeVarTuple("_Ts2") | ^^^^ PYI018 -11 | +11 | 12 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap index 38973cdec6..bb6b4504a1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI018_PYI018.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI018.pyi:6:1: PYI018 Private TypeVar `_T` is never used | 4 | from typing_extensions import ParamSpec, TypeVarTuple -5 | +5 | 6 | _T = typing.TypeVar("_T") | ^^ PYI018 7 | _Ts = typing_extensions.TypeVarTuple("_Ts") @@ -46,6 +45,6 @@ PYI018.pyi:10:1: PYI018 Private TypeVarTuple `_Ts2` is never used 9 | _P2 = typing.ParamSpec("_P2") 10 | _Ts2 = TypeVarTuple("_Ts2") | ^^^^ PYI018 -11 | +11 | 12 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap index d073dea248..0f8e607150 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI019.py:7:62: PYI019 Methods like `__new__` should return `Self` instead of a custom `TypeVar` | @@ -57,57 +56,57 @@ PYI019.py:61:48: PYI019 Methods like `__new__` should return `Self` instead of a 60 | class PEP695Fix: 61 | def __new__[S: PEP695Fix](cls: type[S]) -> S: ... | ^ PYI019 -62 | +62 | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... | PYI019.py:63:47: PYI019 Methods like `__init_subclass__` should return `Self` instead of a custom `TypeVar` | 61 | def __new__[S: PEP695Fix](cls: type[S]) -> S: ... -62 | +62 | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... | ^ PYI019 -64 | +64 | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... | PYI019.py:65:43: PYI019 Methods like `__neg__` should return `Self` instead of a custom `TypeVar` | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... -64 | +64 | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... | ^ PYI019 -66 | +66 | 67 | def __pos__[S](self: S) -> S: ... | PYI019.py:67:32: PYI019 Methods like `__pos__` should return `Self` instead of a custom `TypeVar` | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... -66 | +66 | 67 | def __pos__[S](self: S) -> S: ... | ^ PYI019 -68 | +68 | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... | PYI019.py:69:53: PYI019 Methods like `__add__` should return `Self` instead of a custom `TypeVar` | 67 | def __pos__[S](self: S) -> S: ... -68 | +68 | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... | ^ PYI019 -70 | +70 | 71 | def __sub__[S](self: S, other: S) -> S: ... | PYI019.py:71:42: PYI019 Methods like `__sub__` should return `Self` instead of a custom `TypeVar` | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... -70 | +70 | 71 | def __sub__[S](self: S, other: S) -> S: ... | ^ PYI019 -72 | +72 | 73 | @classmethod | @@ -116,7 +115,7 @@ PYI019.py:74:59: PYI019 Methods like `class_method_bound` should return `Self` i 73 | @classmethod 74 | def class_method_bound[S: PEP695Fix](cls: type[S]) -> S: ... | ^ PYI019 -75 | +75 | 76 | @classmethod | @@ -125,64 +124,64 @@ PYI019.py:77:50: PYI019 Methods like `class_method_unbound` should return `Self` 76 | @classmethod 77 | def class_method_unbound[S](cls: type[S]) -> S: ... | ^ PYI019 -78 | +78 | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... | PYI019.py:79:57: PYI019 Methods like `instance_method_bound` should return `Self` instead of a custom `TypeVar` | 77 | def class_method_unbound[S](cls: type[S]) -> S: ... -78 | +78 | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... | ^ PYI019 -80 | +80 | 81 | def instance_method_unbound[S](self: S) -> S: ... | PYI019.py:81:48: PYI019 Methods like `instance_method_unbound` should return `Self` instead of a custom `TypeVar` | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... -80 | +80 | 81 | def instance_method_unbound[S](self: S) -> S: ... | ^ PYI019 -82 | +82 | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... | PYI019.py:83:90: PYI019 Methods like `instance_method_bound_with_another_parameter` should return `Self` instead of a custom `TypeVar` | 81 | def instance_method_unbound[S](self: S) -> S: ... -82 | +82 | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... | ^ PYI019 -84 | +84 | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... | PYI019.py:85:81: PYI019 Methods like `instance_method_unbound_with_another_parameter` should return `Self` instead of a custom `TypeVar` | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... -84 | +84 | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... | ^ PYI019 -86 | +86 | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... | PYI019.py:87:94: PYI019 Methods like `multiple_type_vars` should return `Self` instead of a custom `TypeVar` | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... -86 | +86 | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... | ^ PYI019 -88 | +88 | 89 | def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ... | PYI019.py:89:75: PYI019 Methods like `mixing_old_and_new_style_type_vars` should return `Self` instead of a custom `TypeVar` | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... -88 | +88 | 89 | def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ... | ^^^^^ PYI019 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap index 9ad778be25..ecad181bcd 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI019_PYI019.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI019.pyi:7:62: PYI019 Methods like `__new__` should return `Self` instead of a custom `TypeVar` | @@ -64,7 +63,7 @@ PYI019.pyi:61:48: PYI019 Methods like `__new__` should return `Self` instead of 60 | class PEP695Fix: 61 | def __new__[S: PEP695Fix](cls: type[S]) -> S: ... | ^ PYI019 -62 | +62 | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... | = help: Replace with `Self` @@ -72,10 +71,10 @@ PYI019.pyi:61:48: PYI019 Methods like `__new__` should return `Self` instead of PYI019.pyi:63:47: PYI019 Methods like `__init_subclass__` should return `Self` instead of a custom `TypeVar` | 61 | def __new__[S: PEP695Fix](cls: type[S]) -> S: ... -62 | +62 | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... | ^ PYI019 -64 | +64 | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... | = help: Replace with `Self` @@ -83,10 +82,10 @@ PYI019.pyi:63:47: PYI019 Methods like `__init_subclass__` should return `Self` i PYI019.pyi:65:43: PYI019 Methods like `__neg__` should return `Self` instead of a custom `TypeVar` | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... -64 | +64 | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... | ^ PYI019 -66 | +66 | 67 | def __pos__[S](self: S) -> S: ... | = help: Replace with `Self` @@ -94,10 +93,10 @@ PYI019.pyi:65:43: PYI019 Methods like `__neg__` should return `Self` instead of PYI019.pyi:67:32: PYI019 Methods like `__pos__` should return `Self` instead of a custom `TypeVar` | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... -66 | +66 | 67 | def __pos__[S](self: S) -> S: ... | ^ PYI019 -68 | +68 | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -105,10 +104,10 @@ PYI019.pyi:67:32: PYI019 Methods like `__pos__` should return `Self` instead of PYI019.pyi:69:53: PYI019 Methods like `__add__` should return `Self` instead of a custom `TypeVar` | 67 | def __pos__[S](self: S) -> S: ... -68 | +68 | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... | ^ PYI019 -70 | +70 | 71 | def __sub__[S](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -116,10 +115,10 @@ PYI019.pyi:69:53: PYI019 Methods like `__add__` should return `Self` instead of PYI019.pyi:71:42: PYI019 Methods like `__sub__` should return `Self` instead of a custom `TypeVar` | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... -70 | +70 | 71 | def __sub__[S](self: S, other: S) -> S: ... | ^ PYI019 -72 | +72 | 73 | @classmethod | = help: Replace with `Self` @@ -129,7 +128,7 @@ PYI019.pyi:74:59: PYI019 Methods like `class_method_bound` should return `Self` 73 | @classmethod 74 | def class_method_bound[S: PEP695Fix](cls: type[S]) -> S: ... | ^ PYI019 -75 | +75 | 76 | @classmethod | = help: Replace with `Self` @@ -139,7 +138,7 @@ PYI019.pyi:77:50: PYI019 Methods like `class_method_unbound` should return `Self 76 | @classmethod 77 | def class_method_unbound[S](cls: type[S]) -> S: ... | ^ PYI019 -78 | +78 | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... | = help: Replace with `Self` @@ -147,10 +146,10 @@ PYI019.pyi:77:50: PYI019 Methods like `class_method_unbound` should return `Self PYI019.pyi:79:57: PYI019 Methods like `instance_method_bound` should return `Self` instead of a custom `TypeVar` | 77 | def class_method_unbound[S](cls: type[S]) -> S: ... -78 | +78 | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... | ^ PYI019 -80 | +80 | 81 | def instance_method_unbound[S](self: S) -> S: ... | = help: Replace with `Self` @@ -158,10 +157,10 @@ PYI019.pyi:79:57: PYI019 Methods like `instance_method_bound` should return `Sel PYI019.pyi:81:48: PYI019 Methods like `instance_method_unbound` should return `Self` instead of a custom `TypeVar` | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... -80 | +80 | 81 | def instance_method_unbound[S](self: S) -> S: ... | ^ PYI019 -82 | +82 | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -169,10 +168,10 @@ PYI019.pyi:81:48: PYI019 Methods like `instance_method_unbound` should return `S PYI019.pyi:83:90: PYI019 Methods like `instance_method_bound_with_another_parameter` should return `Self` instead of a custom `TypeVar` | 81 | def instance_method_unbound[S](self: S) -> S: ... -82 | +82 | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... | ^ PYI019 -84 | +84 | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -180,10 +179,10 @@ PYI019.pyi:83:90: PYI019 Methods like `instance_method_bound_with_another_parame PYI019.pyi:85:81: PYI019 Methods like `instance_method_unbound_with_another_parameter` should return `Self` instead of a custom `TypeVar` | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... -84 | +84 | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... | ^ PYI019 -86 | +86 | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... | = help: Replace with `Self` @@ -191,10 +190,10 @@ PYI019.pyi:85:81: PYI019 Methods like `instance_method_unbound_with_another_para PYI019.pyi:87:94: PYI019 Methods like `multiple_type_vars` should return `Self` instead of a custom `TypeVar` | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... -86 | +86 | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... | ^ PYI019 -88 | +88 | 89 | def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ... | = help: Replace with `Self` @@ -202,7 +201,7 @@ PYI019.pyi:87:94: PYI019 Methods like `multiple_type_vars` should return `Self` PYI019.pyi:89:75: PYI019 Methods like `mixing_old_and_new_style_type_vars` should return `Self` instead of a custom `TypeVar` | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... -88 | +88 | 89 | def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ... | ^^^^^ PYI019 | 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 20e2ab752e..0512085eb1 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI020.pyi:7:10: PYI020 [*] Quoted annotations should not be included in stubs | 5 | import typing_extensions -6 | +6 | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs | ^^^^^ PYI020 8 | def g(x: list["int"]): ... # Y020 Quoted annotations should never be used in stubs @@ -48,7 +47,7 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs 8 | def g(x: list["int"]): ... # Y020 Quoted annotations should never be used in stubs 9 | _T = TypeVar("_T", bound="int") # Y020 Quoted annotations should never be used in stubs | ^^^^^ PYI020 -10 | +10 | 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... | = help: Remove quotes @@ -66,7 +65,7 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs | 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... -12 | +12 | 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs | ^^^^^ PYI020 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs @@ -88,7 +87,7 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs | ^^^^^ PYI020 -15 | +15 | 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs | = help: Remove quotes @@ -106,7 +105,7 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs | 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs -15 | +15 | 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs | ^^^^^ PYI020 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs @@ -170,7 +169,7 @@ PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs 23 | else: 24 | f: "bytes" # Y020 Quoted annotations should never be used in stubs | ^^^^^^^ PYI020 -25 | +25 | 26 | # These two shouldn't trigger Y020 -- empty strings can't be "quoted annotations" | = help: Remove quotes diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap index 26a733c659..98a5e1131c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI024.py:3:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple` | 1 | import collections -2 | +2 | 3 | person: collections.namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" | ^^^^^^^^^^^^^^^^^^^^^^ PYI024 -4 | +4 | 5 | from collections import namedtuple | = help: Replace with `typing.NamedTuple` @@ -16,10 +15,10 @@ PYI024.py:3:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple PYI024.py:7:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple` | 5 | from collections import namedtuple -6 | +6 | 7 | person: namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" | ^^^^^^^^^^ PYI024 -8 | +8 | 9 | person = namedtuple( | = help: Replace with `typing.NamedTuple` @@ -27,7 +26,7 @@ PYI024.py:7:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple PYI024.py:9:10: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple` | 7 | person: namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" - 8 | + 8 | 9 | person = namedtuple( | ^^^^^^^^^^ PYI024 10 | "Person", ["name", "age"] diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap index cb5cf788b5..413264f767 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI024_PYI024.pyi.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI024.pyi:3:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple` | 1 | import collections -2 | +2 | 3 | person: collections.namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" | ^^^^^^^^^^^^^^^^^^^^^^ PYI024 -4 | +4 | 5 | from collections import namedtuple | = help: Replace with `typing.NamedTuple` @@ -16,10 +15,10 @@ PYI024.pyi:3:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtupl PYI024.pyi:7:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple` | 5 | from collections import namedtuple -6 | +6 | 7 | person: namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" | ^^^^^^^^^^ PYI024 -8 | +8 | 9 | person = namedtuple( | = help: Replace with `typing.NamedTuple` @@ -27,7 +26,7 @@ PYI024.pyi:7:9: PYI024 Use `typing.NamedTuple` instead of `collections.namedtupl PYI024.pyi:9:10: PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple` | 7 | person: namedtuple # Y024 Use "typing.NamedTuple" instead of "collections.namedtuple" - 8 | + 8 | 9 | person = namedtuple( | ^^^^^^^^^^ PYI024 10 | "Person", ["name", "age"] diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap index 441394e41a..842c97c533 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI025_1.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | @@ -25,7 +24,7 @@ PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSe 13 | def f(): 14 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 | ^^^ PYI025 -15 | +15 | 16 | GLOBAL: Set[int] = set() | = help: Alias `Set` to `AbstractSet` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap index 04eae20530..e5ca3811d2 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI025_1.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 7 | def f(): 8 | from collections.abc import Set # PYI025 | ^^^ PYI025 - 9 | + 9 | 10 | def f(): | = help: Alias `Set` to `AbstractSet` @@ -27,7 +26,7 @@ PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractS 10 | def f(): 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 | ^^^ PYI025 -12 | +12 | 13 | def f(): | = help: Alias `Set` to `AbstractSet` @@ -80,10 +79,10 @@ PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractS PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 31 | print(Set) -32 | +32 | 33 | from collections.abc import Set | ^^^ PYI025 -34 | +34 | 35 | def f(): | = help: Alias `Set` to `AbstractSet` @@ -126,7 +125,7 @@ PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractS 43 | """Test: nonlocal symbol renaming.""" 44 | from collections.abc import Set | ^^^ PYI025 -45 | +45 | 46 | def g(): | = help: Alias `Set` to `AbstractSet` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap index 31448f859e..284fe29019 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI025_2.py:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 1 | """Tests to ensure we correctly rename references inside `__all__`""" -2 | +2 | 3 | from collections.abc import Set | ^^^ PYI025 -4 | +4 | 5 | __all__ = ["Set"] | = help: Alias `Set` to `AbstractSet` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap index 3b5be7bd6b..88d1423db0 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI025_2.pyi:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 1 | """Tests to ensure we correctly rename references inside `__all__`""" -2 | +2 | 3 | from collections.abc import Set | ^^^ PYI025 -4 | +4 | 5 | __all__ = ["Set"] | = help: Alias `Set` to `AbstractSet` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap index 5d8c7a1004..8e29eb17f3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI025_3.py:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 4 | """ -5 | +5 | 6 | from collections.abc import Set as Set # PYI025 triggered but fix is not marked as safe | ^^^ PYI025 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap index 836003f87e..8eb394f20c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI025_3.pyi:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 4 | """ -5 | +5 | 6 | from collections.abc import Set as Set # PYI025 triggered but fix is not marked as safe | ^^^ PYI025 | 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 92f63d9f4c..b59d96e3d2 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` | 1 | from typing import Literal, Any -2 | +2 | 3 | NewAny = Any | ^^^^^^ PYI026 4 | OptionalStr = typing.Optional[str] @@ -96,7 +95,7 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNo 6 | IntOrStr = int | str 7 | AliasNone = None | ^^^^^^^^^ PYI026 -8 | +8 | 9 | NewAny: typing.TypeAlias = Any | = help: Add `TypeAlias` annotation @@ -120,7 +119,7 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_T 16 | class NotAnEnum: 17 | FLAG_THIS = None | ^^^^^^^^^ PYI026 -18 | +18 | 19 | # these are ok | = help: Add `TypeAlias` annotation 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 231615e3b0..fee6501120 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI029.pyi:10:9: PYI029 [*] Defining `__str__` in a stub is almost always redundant | 9 | class ShouldRemoveSingle: 10 | def __str__(self) -> builtins.str: ... # Error: PYI029 | ^^^^^^^ PYI029 -11 | +11 | 12 | class ShouldRemove: | = help: Remove definition of `__str__` @@ -46,7 +45,7 @@ PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redund 13 | def __repr__(self) -> str: ... # Error: PYI029 14 | def __str__(self) -> builtins.str: ... # Error: PYI029 | ^^^^^^^ PYI029 -15 | +15 | 16 | class NoReturnSpecified: | = help: Remove definition of `__str__` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap index 6fd27a5470..d649aeb619 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI030.py:9:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 8 | # Should emit for duplicate field types. 9 | field2: Literal[1] | Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -10 | +10 | 11 | # Should emit for union types in arguments. | = help: Replace with a single `Literal` @@ -127,7 +126,7 @@ PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single lit 24 | field5: Literal[1] | str | Literal[2] # Error 25 | field6: Literal[1] | bool | Literal[2] | str # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -26 | +26 | 27 | # Should emit for non-type unions. | = help: Replace with a single `Literal` @@ -147,7 +146,7 @@ PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single li 27 | # Should emit for non-type unions. 28 | field7 = Literal[1] | Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -29 | +29 | 30 | # Should emit for parenthesized unions. | = help: Replace with a single `Literal` @@ -167,7 +166,7 @@ PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single lit 30 | # Should emit for parenthesized unions. 31 | field8: Literal[1] | (Literal[2] | str) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -32 | +32 | 33 | # Should handle user parentheses when fixing. | = help: Replace with a single `Literal` @@ -207,7 +206,7 @@ PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single li 34 | field9: Literal[1] | (Literal[2] | str) # Error 35 | field10: (Literal[1] | str) | Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -36 | +36 | 37 | # Should emit for union in generic parent type. | = help: Replace with a single `Literal` @@ -227,7 +226,7 @@ PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single li 37 | # Should emit for union in generic parent type. 38 | field11: dict[Literal[1] | Literal[2], str] # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -39 | +39 | 40 | # Should emit for unions with more than two cases | = help: Replace with a single `Literal` @@ -267,7 +266,7 @@ PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single li 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error 42 | field13: Literal[1] | Literal[2] | Literal[3] | Literal[4] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -43 | +43 | 44 | # Should emit for unions with more than two cases, even if not directly adjacent | = help: Replace with a single `Literal` @@ -287,7 +286,7 @@ PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single li 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -46 | +46 | 47 | # Should emit for unions with mixed literal internal types | = help: Replace with a single `Literal` @@ -307,7 +306,7 @@ PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single li 47 | # Should emit for unions with mixed literal internal types 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -49 | +49 | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 | = help: Replace with a single `Literal` @@ -327,7 +326,7 @@ PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single li 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 | field16: Literal[1] | Literal[1] # OK | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -52 | +52 | 53 | # Shouldn't emit if in new parent type | = help: Replace with a single `Literal` @@ -347,7 +346,7 @@ PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single li 59 | # Should respect name of literal type used 60 | field19: typing.Literal[1] | typing.Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -61 | +61 | 62 | # Should emit in cases with newlines | = help: Replace with a single `Literal` @@ -373,7 +372,7 @@ PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single li 67 | | Literal[2], 68 | | ] # Error, newline and comment will not be emitted in message | |_^ PYI030 -69 | +69 | 70 | # Should handle multiple unions with multiple members | = help: Replace with a single `Literal` @@ -398,7 +397,7 @@ PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single li 70 | # Should handle multiple unions with multiple members 71 | field21: Literal[1, 2] | Literal[3, 4] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -72 | +72 | 73 | # Should emit in cases with `typing.Union` instead of `|` | = help: Replace with a single `Literal` @@ -418,7 +417,7 @@ PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single li 73 | # Should emit in cases with `typing.Union` instead of `|` 74 | field22: typing.Union[Literal[1], Literal[2]] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -75 | +75 | 76 | # Should emit in cases with `typing_extensions.Literal` | = help: Replace with a single `Literal` @@ -438,7 +437,7 @@ PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single li 76 | # Should emit in cases with `typing_extensions.Literal` 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -78 | +78 | 79 | # Should emit in cases with nested `typing.Union` | = help: Replace with a single `Literal` @@ -458,7 +457,7 @@ PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single li 79 | # Should emit in cases with nested `typing.Union` 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -81 | +81 | 82 | # Should emit in cases with mixed `typing.Union` and `|` | = help: Replace with a single `Literal` @@ -478,7 +477,7 @@ PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single li 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -84 | +84 | 85 | # Should emit only once in cases with multiple nested `typing.Union` | = help: Replace with a single `Literal` @@ -498,7 +497,7 @@ PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single li 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -87 | +87 | 88 | # Should use the first literal subscript attribute when fixing | = help: Replace with a single `Literal` @@ -518,7 +517,7 @@ PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single li 88 | # Should use the first literal subscript attribute when fixing 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -90 | +90 | 91 | from typing import IO, Literal | = help: Replace with a single `Literal` @@ -536,7 +535,7 @@ PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single li PYI030.py:93:16: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal["a", "b"]` | 91 | from typing import IO, Literal -92 | +92 | 93 | InlineOption = Literal["a"] | Literal["b"] | IO[str] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap index ed6b8ce87e..86f3114beb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI030.pyi:9:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 8 | # Should emit for duplicate field types. 9 | field2: Literal[1] | Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -10 | +10 | 11 | # Should emit for union types in arguments. | = help: Replace with a single `Literal` @@ -127,7 +126,7 @@ PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single li 24 | field5: Literal[1] | str | Literal[2] # Error 25 | field6: Literal[1] | bool | Literal[2] | str # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -26 | +26 | 27 | # Should emit for non-type unions. | = help: Replace with a single `Literal` @@ -147,7 +146,7 @@ PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single l 27 | # Should emit for non-type unions. 28 | field7 = Literal[1] | Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -29 | +29 | 30 | # Should emit for parenthesized unions. | = help: Replace with a single `Literal` @@ -167,7 +166,7 @@ PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single li 30 | # Should emit for parenthesized unions. 31 | field8: Literal[1] | (Literal[2] | str) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -32 | +32 | 33 | # Should handle user parentheses when fixing. | = help: Replace with a single `Literal` @@ -207,7 +206,7 @@ PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single l 34 | field9: Literal[1] | (Literal[2] | str) # Error 35 | field10: (Literal[1] | str) | Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -36 | +36 | 37 | # Should emit for union in generic parent type. | = help: Replace with a single `Literal` @@ -227,7 +226,7 @@ PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single l 37 | # Should emit for union in generic parent type. 38 | field11: dict[Literal[1] | Literal[2], str] # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -39 | +39 | 40 | # Should emit for unions with more than two cases | = help: Replace with a single `Literal` @@ -267,7 +266,7 @@ PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single l 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error 42 | field13: Literal[1] | Literal[2] | Literal[3] | Literal[4] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -43 | +43 | 44 | # Should emit for unions with more than two cases, even if not directly adjacent | = help: Replace with a single `Literal` @@ -287,7 +286,7 @@ PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single l 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -46 | +46 | 47 | # Should emit for unions with mixed literal internal types | = help: Replace with a single `Literal` @@ -307,7 +306,7 @@ PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single l 47 | # Should emit for unions with mixed literal internal types 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -49 | +49 | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 | = help: Replace with a single `Literal` @@ -327,7 +326,7 @@ PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single l 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 | field16: Literal[1] | Literal[1] # OK | ^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -52 | +52 | 53 | # Shouldn't emit if in new parent type | = help: Replace with a single `Literal` @@ -347,7 +346,7 @@ PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single l 59 | # Should respect name of literal type used 60 | field19: typing.Literal[1] | typing.Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -61 | +61 | 62 | # Should emit in cases with newlines | = help: Replace with a single `Literal` @@ -373,7 +372,7 @@ PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single l 67 | | Literal[2], 68 | | ] # Error, newline and comment will not be emitted in message | |_^ PYI030 -69 | +69 | 70 | # Should handle multiple unions with multiple members | = help: Replace with a single `Literal` @@ -398,7 +397,7 @@ PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single l 70 | # Should handle multiple unions with multiple members 71 | field21: Literal[1, 2] | Literal[3, 4] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -72 | +72 | 73 | # Should emit in cases with `typing.Union` instead of `|` | = help: Replace with a single `Literal` @@ -418,7 +417,7 @@ PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single l 73 | # Should emit in cases with `typing.Union` instead of `|` 74 | field22: typing.Union[Literal[1], Literal[2]] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -75 | +75 | 76 | # Should emit in cases with `typing_extensions.Literal` | = help: Replace with a single `Literal` @@ -438,7 +437,7 @@ PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single l 76 | # Should emit in cases with `typing_extensions.Literal` 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -78 | +78 | 79 | # Should emit in cases with nested `typing.Union` | = help: Replace with a single `Literal` @@ -458,7 +457,7 @@ PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single l 79 | # Should emit in cases with nested `typing.Union` 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -81 | +81 | 82 | # Should emit in cases with mixed `typing.Union` and `|` | = help: Replace with a single `Literal` @@ -478,7 +477,7 @@ PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single l 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -84 | +84 | 85 | # Should emit only once in cases with multiple nested `typing.Union` | = help: Replace with a single `Literal` @@ -498,7 +497,7 @@ PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single l 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI030 -87 | +87 | 88 | # Should use the first literal subscript attribute when fixing | = help: Replace with a single `Literal` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap index ddf4519f8e..7a6209c383 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI035_PYI035.pyi.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI035.pyi:1:1: PYI035 `__all__` in a stub file must have a value, as it has the same semantics as `__all__` at runtime | 1 | __all__: list[str] # Error: PYI035 | ^^^^^^^^^^^^^^^^^^ PYI035 -2 | +2 | 3 | __all__: list[str] = ["foo"] | @@ -25,6 +24,6 @@ PYI035.pyi:8:5: PYI035 `__slots__` in a stub file must have a value, as it has t 7 | __match_args__: tuple[str, ...] # Error: PYI035 8 | __slots__: tuple[str, ...] # Error: PYI035 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI035 - 9 | + 9 | 10 | class Bar: | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap index fee16d7b55..f4b565480b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI042.py:10:1: PYI042 Type alias `just_literals_pipe_union` should be CamelCase | 8 | ) - 9 | + 9 | 10 | just_literals_pipe_union: TypeAlias = ( | ^^^^^^^^^^^^^^^^^^^^^^^^ PYI042 11 | Literal[True] | Literal["idk"] @@ -15,7 +14,7 @@ PYI042.py:10:1: PYI042 Type alias `just_literals_pipe_union` should be CamelCase PYI042.py:19:1: PYI042 Type alias `snake_case_alias1` should be CamelCase | 17 | _PrivateAliasS2: TypeAlias = Annotated[str, "also okay"] -18 | +18 | 19 | snake_case_alias1: TypeAlias = str | int # PYI042, since not camel case | ^^^^^^^^^^^^^^^^^ PYI042 20 | _snake_case_alias2: TypeAlias = Literal["whatever"] # PYI042, since not camel case diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap index 44d9636fca..7e1457c68b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI042_PYI042.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI042.pyi:10:1: PYI042 Type alias `just_literals_pipe_union` should be CamelCase | 8 | ) - 9 | + 9 | 10 | just_literals_pipe_union: TypeAlias = ( | ^^^^^^^^^^^^^^^^^^^^^^^^ PYI042 11 | Literal[True] | Literal["idk"] @@ -15,7 +14,7 @@ PYI042.pyi:10:1: PYI042 Type alias `just_literals_pipe_union` should be CamelCas PYI042.pyi:19:1: PYI042 Type alias `snake_case_alias1` should be CamelCase | 17 | _PrivateAliasS2: TypeAlias = Annotated[str, "also okay"] -18 | +18 | 19 | snake_case_alias1: TypeAlias = str | int # PYI042, since not camel case | ^^^^^^^^^^^^^^^^^ PYI042 20 | _snake_case_alias2: TypeAlias = Literal["whatever"] # PYI042, since not camel case diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap index 8fa3be2dda..d9a02f87e4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI043.py:10:1: PYI043 Private type alias `_PrivateAliasT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) | 8 | ) - 9 | + 9 | 10 | _PrivateAliasT: TypeAlias = str | int # PYI043, since this ends in a T | ^^^^^^^^^^^^^^ PYI043 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap index 1b98a7729b..81526e7463 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI043_PYI043.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI043.pyi:10:1: PYI043 Private type alias `_PrivateAliasT` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`) | 8 | ) - 9 | + 9 | 10 | _PrivateAliasT: TypeAlias = str | int # PYI043, since this ends in a T | ^^^^^^^^^^^^^^ PYI043 11 | _PrivateAliasT2: TypeAlias = typing.Any # PYI043, since this ends in a T diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap index d1595c40da..bb018c27ed 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI044_PYI044.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI044.pyi:2:1: PYI044 `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics | @@ -17,7 +16,7 @@ PYI044.pyi:3:1: PYI044 `from __future__ import annotations` has no effect in stu 2 | from __future__ import annotations # PYI044. 3 | from __future__ import annotations, with_statement # PYI044. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI044 -4 | +4 | 5 | # Good imports. | = help: Remove `from __future__ import annotations` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap index 09b485db0b..bca6451be5 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI045_PYI045.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI045.pyi:9:27: PYI045 `__iter__` methods should return an `Iterator`, not an `Iterable` | @@ -39,7 +38,7 @@ PYI045.pyi:25:27: PYI045 `__iter__` methods should return an `Iterator`, not an 24 | class IterableReturn: 25 | def __iter__(self) -> Iterable: ... # Error: PYI045 | ^^^^^^^^ PYI045 -26 | +26 | 27 | class IteratorReturn: | @@ -48,7 +47,7 @@ PYI045.pyi:46:28: PYI045 `__aiter__` methods should return an `AsyncIterator`, n 45 | class TypingAsyncIterableTReturn: 46 | def __aiter__(self) -> typing.AsyncIterable[int]: ... # Error: PYI045 | ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI045 -47 | +47 | 48 | class TypingAsyncIterableReturn: | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap index 9e0fb19eea..3fda1b217d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI047.py:6:1: PYI047 Private TypeAlias `_UnusedPrivateTypeAlias` is never used | @@ -14,14 +13,14 @@ PYI047.py:7:1: PYI047 Private TypeAlias `_T` is never used 6 | _UnusedPrivateTypeAlias: TypeAlias = int | None 7 | _T: typing.TypeAlias = str | ^^ PYI047 -8 | +8 | 9 | # OK | PYI047.py:24:6: PYI047 Private TypeAlias `_UnusedPEP695` is never used | 22 | def func2(arg: _PrivateTypeAlias) -> None: ... -23 | +23 | 24 | type _UnusedPEP695 = int | ^^^^^^^^^^^^^ PYI047 25 | type _UnusedGeneric695[T] = list[T] @@ -32,6 +31,6 @@ PYI047.py:25:6: PYI047 Private TypeAlias `_UnusedGeneric695` is never used 24 | type _UnusedPEP695 = int 25 | type _UnusedGeneric695[T] = list[T] | ^^^^^^^^^^^^^^^^^ PYI047 -26 | +26 | 27 | type _UsedPEP695 = str | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap index 7d883e58e4..a27c276530 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI047_PYI047.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI047.pyi:6:1: PYI047 Private TypeAlias `_UnusedPrivateTypeAlias` is never used | @@ -14,14 +13,14 @@ PYI047.pyi:7:1: PYI047 Private TypeAlias `_T` is never used 6 | _UnusedPrivateTypeAlias: TypeAlias = int | None 7 | _T: typing.TypeAlias = str | ^^ PYI047 -8 | +8 | 9 | # OK | PYI047.pyi:24:6: PYI047 Private TypeAlias `_UnusedPEP695` is never used | 22 | def func2(arg: _PrivateTypeAlias) -> None: ... -23 | +23 | 24 | type _UnusedPEP695 = int | ^^^^^^^^^^^^^ PYI047 25 | type _UnusedGeneric695[T] = list[T] @@ -32,6 +31,6 @@ PYI047.pyi:25:6: PYI047 Private TypeAlias `_UnusedGeneric695` is never used 24 | type _UnusedPEP695 = int 25 | type _UnusedGeneric695[T] = list[T] | ^^^^^^^^^^^^^^^^^ PYI047 -26 | +26 | 27 | type _UsedPEP695 = str | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap index 185bceeff0..ffd683822a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI048_PYI048.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI048.pyi:8:5: PYI048 Function body must contain exactly one statement | 6 | """oof""" # OK - 7 | + 7 | 8 | def oof(): # ERROR PYI048 | ^^^ PYI048 9 | """oof""" @@ -15,7 +14,7 @@ PYI048.pyi:8:5: PYI048 Function body must contain exactly one statement PYI048.pyi:12:5: PYI048 Function body must contain exactly one statement | 10 | print("foo") -11 | +11 | 12 | def foo(): # ERROR PYI048 | ^^^ PYI048 13 | """foo""" @@ -25,7 +24,7 @@ PYI048.pyi:12:5: PYI048 Function body must contain exactly one statement PYI048.pyi:17:5: PYI048 Function body must contain exactly one statement | 15 | print("foo") -16 | +16 | 17 | def buzz(): # ERROR PYI048 | ^^^^ PYI048 18 | print("fizz") diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap index 4164e08658..68cfc0c50f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI049_PYI049.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI049.pyi:6:7: PYI049 Private TypedDict `_UnusedTypedDict` is never used | @@ -19,7 +18,7 @@ PYI049.pyi:10:7: PYI049 Private TypedDict `_UnusedTypedDict2` is never used PYI049.pyi:34:1: PYI049 Private TypedDict `_UnusedTypedDict3` is never used | 32 | bar: list[int] -33 | +33 | 34 | _UnusedTypedDict3 = TypedDict("_UnusedTypedDict3", {"foo": int}) | ^^^^^^^^^^^^^^^^^ PYI049 35 | _UsedTypedDict3 = TypedDict("_UsedTypedDict3", {"bar": bytes}) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap index db8a1c52f7..84850e38e7 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI051.py:4:18: PYI051 `Literal["foo"]` is redundant in a union with `str` | 2 | from typing import Literal, TypeAlias, Union -3 | +3 | 4 | A: str | Literal["foo"] | ^^^^^ PYI051 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -95,26 +94,26 @@ PYI051.py:10:69: PYI051 `Literal["foo"]` is redundant in a union with `str` 9 | F: TypeAlias = typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] 10 | G: typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] | ^^^^^ PYI051 -11 | +11 | 12 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | PYI051.py:12:31: PYI051 `Literal[1J]` is redundant in a union with `complex` | 10 | G: typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] -11 | +11 | 12 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | ^^ PYI051 -13 | +13 | 14 | # OK | PYI051.py:12:53: PYI051 `Literal[3.14]` is redundant in a union with `float` | 10 | G: typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] -11 | +11 | 12 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | ^^^^ PYI051 -13 | +13 | 14 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap index 8ddcd4893a..cf1f213ca1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI051_PYI051.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI051.pyi:4:18: PYI051 `Literal["foo"]` is redundant in a union with `str` | 2 | from typing import Literal, TypeAlias, Union -3 | +3 | 4 | A: str | Literal["foo"] | ^^^^^ PYI051 5 | B: TypeAlias = typing.Union[Literal[b"bar", b"foo"], bytes, str] @@ -95,26 +94,26 @@ PYI051.pyi:10:69: PYI051 `Literal["foo"]` is redundant in a union with `str` 9 | F: TypeAlias = typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] 10 | G: typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] | ^^^^^ PYI051 -11 | +11 | 12 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | PYI051.pyi:12:31: PYI051 `Literal[1J]` is redundant in a union with `complex` | 10 | G: typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] -11 | +11 | 12 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | ^^ PYI051 -13 | +13 | 14 | # OK | PYI051.pyi:12:53: PYI051 `Literal[3.14]` is redundant in a union with `float` | 10 | G: typing.Union[str, typing.Union[typing.Union[typing.Union[Literal["foo"], int]]]] -11 | +11 | 12 | def func(x: complex | Literal[1J], y: Union[Literal[3.14], float]): ... | ^^^^ PYI051 -13 | +13 | 14 | # OK | 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 de9bc7be61..c6cb6da879 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 @@ -66,10 +66,10 @@ PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK -29 | +29 | 30 | bar: str = "51 character stringgggggggggggggggggggggggggggggggg" # Error: PYI053 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 -31 | +31 | 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK | = help: Replace with `...` @@ -87,10 +87,10 @@ PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK -33 | +33 | 34 | qux: bytes = b"51 character byte stringggggggggggggggggggggggggggg\xff" # Error: PYI053 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 -35 | +35 | 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK | = help: Replace with `...` @@ -108,10 +108,10 @@ PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK -37 | +37 | 38 | fbar: str = f"51 character stringgggggggggggggggggggggggggggggggg" # Error: PYI053 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 -39 | +39 | 40 | class Demo: | = help: Replace with `...` @@ -149,10 +149,10 @@ PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 66 | def not_a_deprecated_function() -> None: ... -67 | +67 | 68 | fbaz: str = f"51 character {foo} stringgggggggggggggggggggggggggg" # Error: PYI053 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI053 -69 | +69 | 70 | from typing import TypeAlias, Literal, Annotated | = help: Replace with `...` 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 dc5e48b97a..ec99151e03 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | @@ -26,7 +25,7 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer 3 | field03: int = -0xFFFFFFFF 4 | field04: int = -0xFFFFFFFFF # Error: PYI054 | ^^^^^^^^^^^ PYI054 -5 | +5 | 6 | field05: int = 1234567890 | = help: Replace with `...` @@ -68,7 +67,7 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe 9 | field08: int = -1234567801 10 | field09: int = -234_567_890 # Error: PYI054 | ^^^^^^^^^^^ PYI054 -11 | +11 | 12 | field10: float = 123.456789 | = help: Replace with `...` @@ -109,7 +108,7 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe 14 | field12: float = -123.456789 15 | field13: float = -123.567_890 # Error: PYI054 | ^^^^^^^^^^^ PYI054 -16 | +16 | 17 | field14: complex = 1e1234567j | = help: Replace with `...` 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 33dd7ff67d..30515dd229 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 @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs PYI055.pyi:4:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. | 2 | from typing import Union -3 | +3 | 4 | s: builtins.type[int] | builtins.type[str] | builtins.type[complex] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 5 | t: type[int] | type[str] | type[float] @@ -152,7 +152,7 @@ PYI055.pyi:11:4: PYI055 [*] Multiple `type` members in a union. Combine them int 10 | y: Union[Union[Union[type[Union[float, int]], type[complex]]]] 11 | z: Union[type[complex], Union[Union[type[Union[float, int]]]]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 -12 | +12 | 13 | def func(arg: type[int] | str | type[float]) -> None: ... | = help: Combine multiple `type` members @@ -170,10 +170,10 @@ PYI055.pyi:11:4: PYI055 [*] Multiple `type` members in a union. Combine them int PYI055.pyi:13:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | float]`. | 11 | z: Union[type[complex], Union[Union[type[Union[float, int]]]]] -12 | +12 | 13 | def func(arg: type[int] | str | type[float]) -> None: ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 -14 | +14 | 15 | # OK | = help: Combine multiple `type` members @@ -193,7 +193,7 @@ PYI055.pyi:23:7: PYI055 [*] Multiple `type` members in a union. Combine them int 22 | # PYI055 23 | item: type[requests_mock.Mocker] | type[httpretty] = requests_mock.Mocker | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 -24 | +24 | 25 | def func(): | = help: Combine multiple `type` members diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap index 1263e37890..c8d9583e3d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI056.py:4:1: PYI056 Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead) | @@ -26,6 +25,6 @@ PYI056.py:6:1: PYI056 Calling `.remove()` on `__all__` may not be supported by a 5 | __all__.extend(["E", "Foo"]) 6 | __all__.remove("A") | ^^^^^^^^^^^^^^ PYI056 -7 | +7 | 8 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap index 5ce21b2983..7e7f78519e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI056_PYI056.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI056.pyi:4:1: PYI056 Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead) | @@ -26,6 +25,6 @@ PYI056.pyi:6:1: PYI056 Calling `.remove()` on `__all__` may not be supported by 5 | __all__.extend(["E", "Foo"]) 6 | __all__.remove("A") | ^^^^^^^^^^^^^^ PYI056 -7 | +7 | 8 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap index d7db1d959c..efdd939335 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI057.py:4:20: PYI057 Do not use `typing.ByteString`, which has unclear semantics and is deprecated | @@ -24,7 +23,7 @@ PYI057.py:5:29: PYI057 Do not use `collections.abc.ByteString`, which has unclea PYI057.py:8:4: PYI057 Do not use `typing.ByteString`, which has unclear semantics and is deprecated | 6 | from foo import ByteString - 7 | + 7 | 8 | a: typing.ByteString | ^^^^^^^^^^^^^^^^^ PYI057 9 | b: collections.abc.ByteString diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap index 0be6f3fa5f..f1c72b4ba9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI057_PYI057.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI057.pyi:4:20: PYI057 Do not use `typing.ByteString`, which has unclear semantics and is deprecated | @@ -24,7 +23,7 @@ PYI057.pyi:5:29: PYI057 Do not use `collections.abc.ByteString`, which has uncle PYI057.pyi:8:4: PYI057 Do not use `typing.ByteString`, which has unclear semantics and is deprecated | 6 | from foo import ByteString - 7 | + 7 | 8 | a: typing.ByteString | ^^^^^^^^^^^^^^^^^ PYI057 9 | b: collections.abc.ByteString diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap index 47c5de12a4..915b6958e0 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI058.pyi:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 4 | class IteratorReturningSimpleGenerator1: 5 | def __iter__(self) -> Generator: ... # PYI058 (use `Iterator`) | ^^^^^^^^ PYI058 -6 | +6 | 7 | def scope(): | = help: Convert the return annotation of your `__iter__` method to `Iterator` @@ -29,7 +28,7 @@ PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 10 | class IteratorReturningSimpleGenerator2: 11 | def __iter__(self) -> typing.Generator: ... # PYI058 (use `Iterator`) | ^^^^^^^^ PYI058 -12 | +12 | 13 | def scope(): | = help: Convert the return annotation of your `__iter__` method to `Iterator` @@ -49,7 +48,7 @@ PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 16 | class IteratorReturningSimpleGenerator3: 17 | def __iter__(self) -> collections.abc.Generator: ... # PYI058 (use `Iterator`) | ^^^^^^^^ PYI058 -18 | +18 | 19 | def scope(): | = help: Convert the return annotation of your `__iter__` method to `Iterator` @@ -69,7 +68,7 @@ PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 23 | class IteratorReturningSimpleGenerator4: 24 | def __iter__(self, /) -> collections.abc.Generator[str, Any, None]: ... # PYI058 (use `Iterator`) | ^^^^^^^^ PYI058 -25 | +25 | 26 | def scope(): | = help: Convert the return annotation of your `__iter__` method to `Iterator` @@ -89,7 +88,7 @@ PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 30 | class IteratorReturningSimpleGenerator5: 31 | def __iter__(self, /) -> collections.abc.Generator[str, None, typing.Any]: ... # PYI058 (use `Iterator`) | ^^^^^^^^ PYI058 -32 | +32 | 33 | def scope(): | = help: Convert the return annotation of your `__iter__` method to `Iterator` @@ -109,7 +108,7 @@ PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 36 | class IteratorReturningSimpleGenerator6: 37 | def __iter__(self, /) -> Generator[str, None, None]: ... # PYI058 (use `Iterator`) | ^^^^^^^^ PYI058 -38 | +38 | 39 | def scope(): | = help: Convert the return annotation of your `__iter__` method to `Iterator` @@ -134,7 +133,7 @@ PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 42 | class AsyncIteratorReturningSimpleAsyncGenerator1: 43 | def __aiter__(self,) -> typing_extensions.AsyncGenerator: ... # PYI058 (Use `AsyncIterator`) | ^^^^^^^^^ PYI058 -44 | +44 | 45 | def scope(): | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` @@ -173,7 +172,7 @@ PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 55 | class AsyncIteratorReturningSimpleAsyncGenerator3: 56 | def __aiter__(self, /) -> collections.abc.AsyncGenerator[str, None]: ... # PYI058 (Use `AsyncIterator`) | ^^^^^^^^^ PYI058 -57 | +57 | 58 | def scope(): | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap index b4095f293a..bc91fb867c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI059.py:8:17: PYI059 [*] `Generic[]` should always be the last base class | 6 | V = TypeVar('V') - 7 | + 7 | 8 | class LinkedList(Generic[T], Sized): # PYI059 | ^^^^^^^^^^^^^^^^^^^ PYI059 9 | def __init__(self) -> None: @@ -26,7 +25,7 @@ PYI059.py:8:17: PYI059 [*] `Generic[]` should always be the last base class PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class | 13 | self._items.append(item) -14 | +14 | 15 | class MyMapping( # PYI059 | ________________^ 16 | | t.Generic[K, V], diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap index 0f0a1bb9d1..275dd20dba 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI059.pyi:8:17: PYI059 [*] `Generic[]` should always be the last base class | 6 | V = TypeVar('V') - 7 | + 7 | 8 | class LinkedList(Generic[T], Sized): # PYI059 | ^^^^^^^^^^^^^^^^^^^ PYI059 9 | def __init__(self) -> None: ... @@ -26,7 +25,7 @@ PYI059.pyi:8:17: PYI059 [*] `Generic[]` should always be the last base class PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class | 10 | def push(self, item: T) -> None: ... -11 | +11 | 12 | class MyMapping( # PYI059 | ________________^ 13 | | t.Generic[K, V], diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.py.snap index 06bec134fe..558d4ee739 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI061.py:4:25: PYI061 [*] `Literal[None]` can be replaced with `None` | @@ -208,7 +207,7 @@ PYI061.py:53:15: PYI061 [*] `Literal[None, ...]` can be replaced with `Literal[. 52 | Literal[None] # Y061 None inside "Literal[]" expression. Replace with "None" 53 | Literal[True, None] # Y061 None inside "Literal[]" expression. Replace with "Literal[True] | None" | ^^^^ PYI061 -54 | +54 | 55 | ### | = help: Replace with `Literal[...] | None` @@ -269,7 +268,7 @@ PYI061.py:63:12: PYI061 [*] `Literal[None, ...]` can be replaced with `Literal[. 62 | Literal[None, None] # Y061 None inside "Literal[]" expression. Replace with "None" 63 | Literal[1, None, "foo", None] # Y061 None inside "Literal[]" expression. Replace with "Literal[1, 'foo'] | None" | ^^^^ PYI061 -64 | +64 | 65 | # ... but if Y061 and Y062 both apply | = help: Replace with `Literal[...] | None` @@ -290,7 +289,7 @@ PYI061.py:63:25: PYI061 [*] `Literal[None, ...]` can be replaced with `Literal[. 62 | Literal[None, None] # Y061 None inside "Literal[]" expression. Replace with "None" 63 | Literal[1, None, "foo", None] # Y061 None inside "Literal[]" expression. Replace with "Literal[1, 'foo'] | None" | ^^^^ PYI061 -64 | +64 | 65 | # ... but if Y061 and Y062 both apply | = help: Replace with `Literal[...] | None` @@ -369,7 +368,7 @@ PYI061.py:74:18: PYI061 [*] `Literal[None]` can be replaced with `None` 73 | y: None | Literal[None] 74 | z: Union[Literal[None], None] | ^^^^ PYI061 -75 | +75 | 76 | a: int | Literal[None] | None | = help: Replace with `None` @@ -387,7 +386,7 @@ PYI061.py:74:18: PYI061 [*] `Literal[None]` can be replaced with `None` PYI061.py:76:18: PYI061 `Literal[None]` can be replaced with `None` | 74 | z: Union[Literal[None], None] -75 | +75 | 76 | a: int | Literal[None] | None | ^^^^ PYI061 77 | b: None | Literal[None] | None diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.pyi.snap index 1352d24f39..e1bc23eca4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI061_PYI061.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI061.pyi:4:25: PYI061 [*] `Literal[None]` can be replaced with `None` | @@ -238,7 +237,7 @@ PYI061.pyi:49:18: PYI061 [*] `Literal[None]` can be replaced with `None` 48 | y: None | Literal[None] 49 | z: Union[Literal[None], None] | ^^^^ PYI061 -50 | +50 | 51 | a: int | Literal[None] | None | = help: Replace with `None` @@ -256,7 +255,7 @@ PYI061.pyi:49:18: PYI061 [*] `Literal[None]` can be replaced with `None` PYI061.pyi:51:18: PYI061 `Literal[None]` can be replaced with `None` | 49 | z: Union[Literal[None], None] -50 | +50 | 51 | a: int | Literal[None] | None | ^^^^ PYI061 52 | b: None | Literal[None] | None diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap index a2f290e969..6af025078b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.py.snap @@ -4,10 +4,10 @@ source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs PYI062.py:5:25: PYI062 [*] Duplicate literal member `True` | 3 | import typing_extensions -4 | +4 | 5 | x: Literal[True, False, True, False] # PYI062 twice here | ^^^^ PYI062 -6 | +6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | = help: Remove duplicates @@ -25,10 +25,10 @@ PYI062.py:5:25: PYI062 [*] Duplicate literal member `True` PYI062.py:5:31: PYI062 [*] Duplicate literal member `False` | 3 | import typing_extensions -4 | +4 | 5 | x: Literal[True, False, True, False] # PYI062 twice here | ^^^^^ PYI062 -6 | +6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | = help: Remove duplicates @@ -46,10 +46,10 @@ PYI062.py:5:31: PYI062 [*] Duplicate literal member `False` PYI062.py:7:45: PYI062 [*] Duplicate literal member `1` | 5 | x: Literal[True, False, True, False] # PYI062 twice here -6 | +6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | ^ PYI062 -8 | +8 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal | = help: Remove duplicates @@ -67,10 +67,10 @@ PYI062.py:7:45: PYI062 [*] Duplicate literal member `1` PYI062.py:9:33: PYI062 [*] Duplicate literal member `{1, 3, 5}` | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 - 8 | + 8 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal | ^^^^^^^ PYI062 -10 | +10 | 11 | Literal[1, Literal[1]] # once | = help: Remove duplicates @@ -88,7 +88,7 @@ PYI062.py:9:33: PYI062 [*] Duplicate literal member `{1, 3, 5}` PYI062.py:11:20: PYI062 [*] Duplicate literal member `1` | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal -10 | +10 | 11 | Literal[1, Literal[1]] # once | ^ PYI062 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -303,7 +303,7 @@ PYI062.py:25:46: PYI062 [*] Duplicate literal member `True` 24 | # Ensure issue is only raised once, even on nested literals 25 | MyType = Literal["foo", Literal[True, False, True], "bar"] # PYI062 | ^^^^ PYI062 -26 | +26 | 27 | n: Literal["No", "duplicates", "here", 1, "1"] | = help: Remove duplicates diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap index f03c08bc34..60d45bc3c7 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI062_PYI062.pyi.snap @@ -4,10 +4,10 @@ source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs PYI062.pyi:5:25: PYI062 [*] Duplicate literal member `True` | 3 | import typing_extensions -4 | +4 | 5 | x: Literal[True, False, True, False] # PYI062 twice here | ^^^^ PYI062 -6 | +6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | = help: Remove duplicates @@ -25,10 +25,10 @@ PYI062.pyi:5:25: PYI062 [*] Duplicate literal member `True` PYI062.pyi:5:31: PYI062 [*] Duplicate literal member `False` | 3 | import typing_extensions -4 | +4 | 5 | x: Literal[True, False, True, False] # PYI062 twice here | ^^^^^ PYI062 -6 | +6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | = help: Remove duplicates @@ -46,10 +46,10 @@ PYI062.pyi:5:31: PYI062 [*] Duplicate literal member `False` PYI062.pyi:7:45: PYI062 [*] Duplicate literal member `1` | 5 | x: Literal[True, False, True, False] # PYI062 twice here -6 | +6 | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 | ^ PYI062 -8 | +8 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal | = help: Remove duplicates @@ -67,10 +67,10 @@ PYI062.pyi:7:45: PYI062 [*] Duplicate literal member `1` PYI062.pyi:9:33: PYI062 [*] Duplicate literal member `{1, 3, 5}` | 7 | y: Literal[1, print("hello"), 3, Literal[4, 1]] # PYI062 on the last 1 - 8 | + 8 | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal | ^^^^^^^ PYI062 -10 | +10 | 11 | Literal[1, Literal[1]] # once | = help: Remove duplicates @@ -88,7 +88,7 @@ PYI062.pyi:9:33: PYI062 [*] Duplicate literal member `{1, 3, 5}` PYI062.pyi:11:20: PYI062 [*] Duplicate literal member `1` | 9 | z: Literal[{1, 3, 5}, "foobar", {1,3,5}] # PYI062 on the set literal -10 | +10 | 11 | Literal[1, Literal[1]] # once | ^ PYI062 12 | Literal[1, 2, Literal[1, 2]] # twice @@ -303,7 +303,7 @@ PYI062.pyi:25:46: PYI062 [*] Duplicate literal member `True` 24 | # Ensure issue is only raised once, even on nested literals 25 | MyType = Literal["foo", Literal[True, False, True], "bar"] # PYI062 | ^^^^ PYI062 -26 | +26 | 27 | n: Literal["No", "duplicates", "here", 1, "1"] | = help: Remove duplicates diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap index 04c88e35cf..044005bebb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs PYI063.py:6:9: PYI063 Use PEP 570 syntax for positional-only parameters | 4 | from typing import Self -5 | +5 | 6 | def bad(__x: int) -> None: ... # PYI063 | ^^^ PYI063 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 @@ -27,7 +27,7 @@ PYI063.py:8:15: PYI063 Use PEP 570 syntax for positional-only parameters 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 8 | def still_bad(__x_: int) -> None: ... # PYI063 | ^^^^ PYI063 - 9 | + 9 | 10 | def no_args() -> None: ... | = help: Add `/` to function signature @@ -82,7 +82,7 @@ PYI063.py:30:23: PYI063 Use PEP 570 syntax for positional-only parameters 29 | @classmethod 30 | def not_good(cls, __foo: int) -> None: ... # PYI063 | ^^^^^ PYI063 -31 | +31 | 32 | # The first non-self argument isn't positional-only, so logically the second can't be either: | = help: Add `/` to function signature @@ -93,7 +93,7 @@ PYI063.py:52:23: PYI063 Use PEP 570 syntax for positional-only parameters 51 | @classmethod 52 | def __new__(mcls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 | ^^^^^^ PYI063 -53 | +53 | 54 | class Metaclass2(type): | = help: Add `/` to function signature @@ -104,7 +104,7 @@ PYI063.py:56:26: PYI063 Use PEP 570 syntax for positional-only parameters 55 | @classmethod 56 | def __new__(metacls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 | ^^^^^^ PYI063 -57 | +57 | 58 | class GoodMetaclass(type): | = help: Add `/` to function signature diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap index f7d4f4de54..093baf963a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI063_PYI063.pyi.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs PYI063.pyi:6:9: PYI063 Use PEP 570 syntax for positional-only parameters | 4 | from typing import Self -5 | +5 | 6 | def bad(__x: int) -> None: ... # PYI063 | ^^^ PYI063 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 @@ -27,7 +27,7 @@ PYI063.pyi:8:15: PYI063 Use PEP 570 syntax for positional-only parameters 7 | def also_bad(__x: int, __y: str) -> None: ... # PYI063 8 | def still_bad(__x_: int) -> None: ... # PYI063 | ^^^^ PYI063 - 9 | + 9 | 10 | def no_args() -> None: ... | = help: Add `/` to function signature @@ -82,7 +82,7 @@ PYI063.pyi:30:23: PYI063 Use PEP 570 syntax for positional-only parameters 29 | @classmethod 30 | def not_good(cls, __foo: int) -> None: ... # PYI063 | ^^^^^ PYI063 -31 | +31 | 32 | # The first non-self argument isn't positional-only, so logically the second can't be either: | = help: Add `/` to function signature @@ -93,7 +93,7 @@ PYI063.pyi:52:23: PYI063 Use PEP 570 syntax for positional-only parameters 51 | @classmethod 52 | def __new__(mcls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 | ^^^^^^ PYI063 -53 | +53 | 54 | class Metaclass2(type): | = help: Add `/` to function signature @@ -104,7 +104,7 @@ PYI063.pyi:56:26: PYI063 Use PEP 570 syntax for positional-only parameters 55 | @classmethod 56 | def __new__(metacls, __name: str, __bases: tuple[type, ...], __namespace: dict, **kwds) -> Self: ... # PYI063 | ^^^^^^ PYI063 -57 | +57 | 58 | class GoodMetaclass(type): | = help: Add `/` to function signature diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap index 6024f77555..f212abc18b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI064.py:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `Final` | 1 | from typing import Final, Literal -2 | +2 | 3 | x: Final[Literal[True]] = True # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI064 4 | y: Final[Literal[None]] = None # PYI064 @@ -50,7 +49,7 @@ PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fin 6 | | "this is a really long literal, that won't be rendered in the issue text" 7 | | ]] = "this is a really long literal, that won't be rendered in the issue text" | |______________________________________________________________________________^ PYI064 -8 | +8 | 9 | # This should be fixable, and marked as safe | = help: Replace with `Final` @@ -72,7 +71,7 @@ PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi 9 | # This should be fixable, and marked as safe 10 | w1: Final[Literal[123]] # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^ PYI064 -11 | +11 | 12 | # This should not be fixable | = help: Replace with `Final` @@ -92,7 +91,7 @@ PYI064.py:13:1: PYI064 `Final[Literal[123]]` can be replaced with a bare `Final` 12 | # This should not be fixable 13 | w2: Final[Literal[123]] = "random value" # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI064 -14 | +14 | 15 | n1: Final[Literal[True, False]] = True # No issue here | = help: Replace with `Final` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap index 6bd5bb04b4..b02cfb5cc8 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI064.pyi:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `Final` | 1 | from typing import Final, Literal -2 | +2 | 3 | x: Final[Literal[True]] # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^ PYI064 4 | y: Final[Literal[None]] = None # PYI064 @@ -47,7 +46,7 @@ PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fi 4 | y: Final[Literal[None]] = None # PYI064 5 | z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI064 -6 | +6 | 7 | # This should be fixable, and marked as safe | = help: Replace with `Final` @@ -67,7 +66,7 @@ PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi 7 | # This should be fixable, and marked as safe 8 | w1: Final[Literal[123]] # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^ PYI064 - 9 | + 9 | 10 | # This should not be fixable | = help: Replace with `Final` @@ -87,7 +86,7 @@ PYI064.pyi:11:1: PYI064 `Final[Literal[123]]` can be replaced with a bare `Final 10 | # This should not be fixable 11 | w2: Final[Literal[123]] = "random value" # PYI064 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI064 -12 | +12 | 13 | n1: Final[Literal[True, False]] # No issue here | = help: Replace with `Final` diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__custom_classmethod_rules_preview.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__custom_classmethod_rules_preview.snap index 57ed22c125..9ed684d0c3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__custom_classmethod_rules_preview.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__custom_classmethod_rules_preview.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI019.pyi:7:62: PYI019 Methods like `__new__` should return `Self` instead of a custom `TypeVar` | @@ -134,7 +133,7 @@ PYI019.pyi:61:48: PYI019 [*] Methods like `__new__` should return `Self` instead 60 | class PEP695Fix: 61 | def __new__[S: PEP695Fix](cls: type[S]) -> S: ... | ^ PYI019 -62 | +62 | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... | = help: Replace with `Self` @@ -152,10 +151,10 @@ PYI019.pyi:61:48: PYI019 [*] Methods like `__new__` should return `Self` instead PYI019.pyi:63:47: PYI019 [*] Methods like `__init_subclass__` should return `Self` instead of a custom `TypeVar` | 61 | def __new__[S: PEP695Fix](cls: type[S]) -> S: ... -62 | +62 | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... | ^ PYI019 -64 | +64 | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... | = help: Replace with `Self` @@ -173,10 +172,10 @@ PYI019.pyi:63:47: PYI019 [*] Methods like `__init_subclass__` should return `Sel PYI019.pyi:65:43: PYI019 [*] Methods like `__neg__` should return `Self` instead of a custom `TypeVar` | 63 | def __init_subclass__[S](cls: type[S]) -> S: ... -64 | +64 | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... | ^ PYI019 -66 | +66 | 67 | def __pos__[S](self: S) -> S: ... | = help: Replace with `Self` @@ -194,10 +193,10 @@ PYI019.pyi:65:43: PYI019 [*] Methods like `__neg__` should return `Self` instead PYI019.pyi:67:32: PYI019 [*] Methods like `__pos__` should return `Self` instead of a custom `TypeVar` | 65 | def __neg__[S: PEP695Fix](self: S) -> S: ... -66 | +66 | 67 | def __pos__[S](self: S) -> S: ... | ^ PYI019 -68 | +68 | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -215,10 +214,10 @@ PYI019.pyi:67:32: PYI019 [*] Methods like `__pos__` should return `Self` instead PYI019.pyi:69:53: PYI019 [*] Methods like `__add__` should return `Self` instead of a custom `TypeVar` | 67 | def __pos__[S](self: S) -> S: ... -68 | +68 | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... | ^ PYI019 -70 | +70 | 71 | def __sub__[S](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -236,10 +235,10 @@ PYI019.pyi:69:53: PYI019 [*] Methods like `__add__` should return `Self` instead PYI019.pyi:71:42: PYI019 [*] Methods like `__sub__` should return `Self` instead of a custom `TypeVar` | 69 | def __add__[S: PEP695Fix](self: S, other: S) -> S: ... -70 | +70 | 71 | def __sub__[S](self: S, other: S) -> S: ... | ^ PYI019 -72 | +72 | 73 | @classmethod | = help: Replace with `Self` @@ -259,7 +258,7 @@ PYI019.pyi:74:59: PYI019 [*] Methods like `class_method_bound` should return `Se 73 | @classmethod 74 | def class_method_bound[S: PEP695Fix](cls: type[S]) -> S: ... | ^ PYI019 -75 | +75 | 76 | @classmethod | = help: Replace with `Self` @@ -279,7 +278,7 @@ PYI019.pyi:77:50: PYI019 [*] Methods like `class_method_unbound` should return ` 76 | @classmethod 77 | def class_method_unbound[S](cls: type[S]) -> S: ... | ^ PYI019 -78 | +78 | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... | = help: Replace with `Self` @@ -297,10 +296,10 @@ PYI019.pyi:77:50: PYI019 [*] Methods like `class_method_unbound` should return ` PYI019.pyi:79:57: PYI019 [*] Methods like `instance_method_bound` should return `Self` instead of a custom `TypeVar` | 77 | def class_method_unbound[S](cls: type[S]) -> S: ... -78 | +78 | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... | ^ PYI019 -80 | +80 | 81 | def instance_method_unbound[S](self: S) -> S: ... | = help: Replace with `Self` @@ -318,10 +317,10 @@ PYI019.pyi:79:57: PYI019 [*] Methods like `instance_method_bound` should return PYI019.pyi:81:48: PYI019 [*] Methods like `instance_method_unbound` should return `Self` instead of a custom `TypeVar` | 79 | def instance_method_bound[S: PEP695Fix](self: S) -> S: ... -80 | +80 | 81 | def instance_method_unbound[S](self: S) -> S: ... | ^ PYI019 -82 | +82 | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -339,10 +338,10 @@ PYI019.pyi:81:48: PYI019 [*] Methods like `instance_method_unbound` should retur PYI019.pyi:83:90: PYI019 [*] Methods like `instance_method_bound_with_another_parameter` should return `Self` instead of a custom `TypeVar` | 81 | def instance_method_unbound[S](self: S) -> S: ... -82 | +82 | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... | ^ PYI019 -84 | +84 | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... | = help: Replace with `Self` @@ -360,10 +359,10 @@ PYI019.pyi:83:90: PYI019 [*] Methods like `instance_method_bound_with_another_pa PYI019.pyi:85:81: PYI019 [*] Methods like `instance_method_unbound_with_another_parameter` should return `Self` instead of a custom `TypeVar` | 83 | def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ... -84 | +84 | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... | ^ PYI019 -86 | +86 | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... | = help: Replace with `Self` @@ -381,10 +380,10 @@ PYI019.pyi:85:81: PYI019 [*] Methods like `instance_method_unbound_with_another_ PYI019.pyi:87:94: PYI019 Methods like `multiple_type_vars` should return `Self` instead of a custom `TypeVar` | 85 | def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ... -86 | +86 | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... | ^ PYI019 -88 | +88 | 89 | def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ... | = help: Replace with `Self` @@ -401,7 +400,7 @@ PYI019.pyi:87:94: PYI019 Methods like `multiple_type_vars` should return `Self` PYI019.pyi:89:75: PYI019 Methods like `mixing_old_and_new_style_type_vars` should return `Self` instead of a custom `TypeVar` | 87 | def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ... -88 | +88 | 89 | def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ... | ^^^^^ PYI019 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap index fbeb56a996..4ae21763be 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__preview__PYI044_PYI044.pyi.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI044.pyi:2:1: PYI044 [*] `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics | @@ -24,7 +23,7 @@ PYI044.pyi:3:1: PYI044 [*] `from __future__ import annotations` has no effect in 2 | from __future__ import annotations # PYI044. 3 | from __future__ import annotations, with_statement # PYI044. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI044 -4 | +4 | 5 | # Good imports. | = help: Remove `from __future__ import annotations` 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 50f0d9a5fe..17bb45aedd 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs -snapshot_kind: text --- PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` | 1 | from typing import Literal, Any -2 | +2 | 3 | NewAny = Any | ^^^^^^ PYI026 4 | OptionalStr = typing.Optional[str] @@ -96,7 +95,7 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 6 | IntOrStr = int | str 7 | AliasNone = None | ^^^^^^^^^ PYI026 -8 | +8 | 9 | NewAny: typing.TypeAlias = Any | = help: Add `TypeAlias` annotation @@ -120,7 +119,7 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e. 16 | class NotAnEnum: 17 | FLAG_THIS = None | ^^^^^^^^^ PYI026 -18 | +18 | 19 | # these are ok | = help: Add `TypeAlias` annotation 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 3a95ca7c64..8bcf1ce60d 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | @@ -24,7 +23,7 @@ PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 24 | / @pytest.fixture( -25 | | +25 | | 26 | | ) | |_^ PT001 27 | def parentheses_no_params_multiline(): @@ -66,7 +65,7 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 49 | / @fixture( -50 | | +50 | | 51 | | ) | |_^ PT001 52 | def imported_from_parentheses_no_params_multiline(): @@ -108,7 +107,7 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 74 | / @aliased( -75 | | +75 | | 76 | | ) | |_^ PT001 77 | def aliased_parentheses_no_params_multiline(): diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_and_PT007.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_and_PT007.snap index 8427630045..53fcf3c33a 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_and_PT007.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_and_PT007.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT006_and_PT007.py:3:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str` | 1 | import pytest -2 | +2 | 3 | @pytest.mark.parametrize(("param",), [[1], [2]]) | ^^^^^^^^^^ PT006 4 | def test_PT006_and_PT007_do_not_conflict(param): @@ -24,7 +23,7 @@ PT006_and_PT007.py:3:26: PT006 [*] Wrong type passed to first argument of `pytes PT006_and_PT007.py:3:39: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `tuple` | 1 | import pytest -2 | +2 | 3 | @pytest.mark.parametrize(("param",), [[1], [2]]) | ^^^ PT007 4 | def test_PT006_and_PT007_do_not_conflict(param): @@ -43,7 +42,7 @@ PT006_and_PT007.py:3:39: PT007 [*] Wrong values type in `pytest.mark.parametrize PT006_and_PT007.py:3:44: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `tuple` | 1 | import pytest -2 | +2 | 3 | @pytest.mark.parametrize(("param",), [[1], [2]]) | ^^^ PT007 4 | def test_PT006_and_PT007_do_not_conflict(param): 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 fc83efbb15..fa23a2d752 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 @@ -234,7 +234,7 @@ PT006.py:74:39: PT006 [*] Wrong type passed to first argument of `pytest.mark.pa | 74 | parametrize = pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ PT006 -75 | +75 | 76 | @parametrize | = help: Use a `tuple` for the first argument 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 de2c60ae03..8ccc8345e7 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 @@ -196,7 +196,7 @@ PT006.py:74:39: PT006 [*] Wrong type passed to first argument of `pytest.mark.pa | 74 | parametrize = pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ PT006 -75 | +75 | 76 | @parametrize | = help: Use a `list` for the first argument diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap index 04372accb8..7d366bf5c4 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT008.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT008.py:35:1: PT008 Use `return_value=` instead of patching with `lambda` | 33 | # Error -34 | +34 | 35 | mocker.patch("module.name", lambda: None) | ^^^^^^^^^^^^ PT008 36 | module_mocker.patch("module.name", lambda: None) @@ -36,14 +35,14 @@ PT008.py:38:1: PT008 Use `return_value=` instead of patching with `lambda` 37 | mocker.patch.object(obj, "attr", lambda: None) 38 | module_mocker.patch.object(obj, "attr", lambda: None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT008 -39 | +39 | 40 | mocker.patch("module.name", lambda x, y: None) | PT008.py:40:1: PT008 Use `return_value=` instead of patching with `lambda` | 38 | module_mocker.patch.object(obj, "attr", lambda: None) -39 | +39 | 40 | mocker.patch("module.name", lambda x, y: None) | ^^^^^^^^^^^^ PT008 41 | module_mocker.patch("module.name", lambda x, y: None) @@ -74,14 +73,14 @@ PT008.py:43:1: PT008 Use `return_value=` instead of patching with `lambda` 42 | mocker.patch.object(obj, "attr", lambda x, y: None) 43 | module_mocker.patch.object(obj, "attr", lambda x, y: None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT008 -44 | +44 | 45 | mocker.patch("module.name", lambda *args, **kwargs: None) | PT008.py:45:1: PT008 Use `return_value=` instead of patching with `lambda` | 43 | module_mocker.patch.object(obj, "attr", lambda x, y: None) -44 | +44 | 45 | mocker.patch("module.name", lambda *args, **kwargs: None) | ^^^^^^^^^^^^ PT008 46 | module_mocker.patch("module.name", lambda *args, **kwargs: None) 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 3a26cdd240..54aa27fa16 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | @@ -179,7 +178,7 @@ PT009.py:25:16: PT009 Use a regular `assert` instead of unittest-style `assertEq 24 | ) 25 | return self.assertEqual(True, False) # Error, unfixable | ^^^^^^^^^^^^^^^^ PT009 -26 | +26 | 27 | def test_assert_false(self): | = help: Replace `assertEqual(...)` with `assert ...` @@ -189,7 +188,7 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 27 | def test_assert_false(self): 28 | self.assertFalse(True) # Error | ^^^^^^^^^^^^^^^^ PT009 -29 | +29 | 30 | def test_assert_equal(self): | = help: Replace `assertFalse(...)` with `assert ...` @@ -209,7 +208,7 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 30 | def test_assert_equal(self): 31 | self.assertEqual(1, 2) # Error | ^^^^^^^^^^^^^^^^ PT009 -32 | +32 | 33 | def test_assert_not_equal(self): | = help: Replace `assertEqual(...)` with `assert ...` @@ -229,7 +228,7 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 33 | def test_assert_not_equal(self): 34 | self.assertNotEqual(1, 1) # Error | ^^^^^^^^^^^^^^^^^^^ PT009 -35 | +35 | 36 | def test_assert_greater(self): | = help: Replace `assertNotEqual(...)` with `assert ...` @@ -249,7 +248,7 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 36 | def test_assert_greater(self): 37 | self.assertGreater(1, 2) # Error | ^^^^^^^^^^^^^^^^^^ PT009 -38 | +38 | 39 | def test_assert_greater_equal(self): | = help: Replace `assertGreater(...)` with `assert ...` @@ -269,7 +268,7 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 39 | def test_assert_greater_equal(self): 40 | self.assertGreaterEqual(1, 2) # Error | ^^^^^^^^^^^^^^^^^^^^^^^ PT009 -41 | +41 | 42 | def test_assert_less(self): | = help: Replace `assertGreaterEqual(...)` with `assert ...` @@ -289,7 +288,7 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 42 | def test_assert_less(self): 43 | self.assertLess(2, 1) # Error | ^^^^^^^^^^^^^^^ PT009 -44 | +44 | 45 | def test_assert_less_equal(self): | = help: Replace `assertLess(...)` with `assert ...` @@ -309,7 +308,7 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 45 | def test_assert_less_equal(self): 46 | self.assertLessEqual(1, 2) # Error | ^^^^^^^^^^^^^^^^^^^^ PT009 -47 | +47 | 48 | def test_assert_in(self): | = help: Replace `assertLessEqual(...)` with `assert ...` @@ -329,7 +328,7 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 48 | def test_assert_in(self): 49 | self.assertIn(1, [2, 3]) # Error | ^^^^^^^^^^^^^ PT009 -50 | +50 | 51 | def test_assert_not_in(self): | = help: Replace `assertIn(...)` with `assert ...` @@ -349,7 +348,7 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 51 | def test_assert_not_in(self): 52 | self.assertNotIn(2, [2, 3]) # Error | ^^^^^^^^^^^^^^^^ PT009 -53 | +53 | 54 | def test_assert_is_none(self): | = help: Replace `assertNotIn(...)` with `assert ...` @@ -369,7 +368,7 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 54 | def test_assert_is_none(self): 55 | self.assertIsNone(0) # Error | ^^^^^^^^^^^^^^^^^ PT009 -56 | +56 | 57 | def test_assert_is_not_none(self): | = help: Replace `assertIsNone(...)` with `assert ...` @@ -389,7 +388,7 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 57 | def test_assert_is_not_none(self): 58 | self.assertIsNotNone(0) # Error | ^^^^^^^^^^^^^^^^^^^^ PT009 -59 | +59 | 60 | def test_assert_is(self): | = help: Replace `assertIsNotNone(...)` with `assert ...` @@ -409,7 +408,7 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 60 | def test_assert_is(self): 61 | self.assertIs([], []) # Error | ^^^^^^^^^^^^^ PT009 -62 | +62 | 63 | def test_assert_is_not(self): | = help: Replace `assertIs(...)` with `assert ...` @@ -429,7 +428,7 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 63 | def test_assert_is_not(self): 64 | self.assertIsNot(1, 1) # Error | ^^^^^^^^^^^^^^^^ PT009 -65 | +65 | 66 | def test_assert_is_instance(self): | = help: Replace `assertIsNot(...)` with `assert ...` @@ -449,7 +448,7 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 66 | def test_assert_is_instance(self): 67 | self.assertIsInstance(1, str) # Error | ^^^^^^^^^^^^^^^^^^^^^ PT009 -68 | +68 | 69 | def test_assert_is_not_instance(self): | = help: Replace `assertIsInstance(...)` with `assert ...` @@ -469,7 +468,7 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 69 | def test_assert_is_not_instance(self): 70 | self.assertNotIsInstance(1, int) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^ PT009 -71 | +71 | 72 | def test_assert_regex(self): | = help: Replace `assertNotIsInstance(...)` with `assert ...` @@ -489,7 +488,7 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 72 | def test_assert_regex(self): 73 | self.assertRegex("abc", r"def") # Error | ^^^^^^^^^^^^^^^^ PT009 -74 | +74 | 75 | def test_assert_not_regex(self): | = help: Replace `assertRegex(...)` with `assert ...` @@ -509,7 +508,7 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 75 | def test_assert_not_regex(self): 76 | self.assertNotRegex("abc", r"abc") # Error | ^^^^^^^^^^^^^^^^^^^ PT009 -77 | +77 | 78 | def test_assert_regexp_matches(self): | = help: Replace `assertNotRegex(...)` with `assert ...` @@ -529,7 +528,7 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 78 | def test_assert_regexp_matches(self): 79 | self.assertRegexpMatches("abc", r"def") # Error | ^^^^^^^^^^^^^^^^^^^^^^^^ PT009 -80 | +80 | 81 | def test_assert_not_regexp_matches(self): | = help: Replace `assertRegexpMatches(...)` with `assert ...` @@ -549,7 +548,7 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 81 | def test_assert_not_regexp_matches(self): 82 | self.assertNotRegex("abc", r"abc") # Error | ^^^^^^^^^^^^^^^^^^^ PT009 -83 | +83 | 84 | def test_fail_if(self): | = help: Replace `assertNotRegex(...)` with `assert ...` @@ -569,7 +568,7 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI 84 | def test_fail_if(self): 85 | self.failIf("abc") # Error | ^^^^^^^^^^^ PT009 -86 | +86 | 87 | def test_fail_unless(self): | = help: Replace `failIf(...)` with `assert ...` @@ -589,7 +588,7 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU 87 | def test_fail_unless(self): 88 | self.failUnless("abc") # Error | ^^^^^^^^^^^^^^^ PT009 -89 | +89 | 90 | def test_fail_unless_equal(self): | = help: Replace `failUnless(...)` with `assert ...` @@ -609,7 +608,7 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU 90 | def test_fail_unless_equal(self): 91 | self.failUnlessEqual(1, 2) # Error | ^^^^^^^^^^^^^^^^^^^^ PT009 -92 | +92 | 93 | def test_fail_if_equal(self): | = help: Replace `failUnlessEqual(...)` with `assert ...` diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap index 6b57732fdc..57b6b6f393 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_default.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT011.py:18:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | @@ -13,7 +12,7 @@ PT011.py:18:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:21:43: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 19 | raise ValueError("Can't divide 1 by 0") -20 | +20 | 21 | with pytest.raises(expected_exception=ValueError): | ^^^^^^^^^^ PT011 22 | raise ValueError("Can't divide 1 by 0") @@ -22,7 +21,7 @@ PT011.py:21:43: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:24:24: PT011 `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception | 22 | raise ValueError("Can't divide 1 by 0") -23 | +23 | 24 | with pytest.raises(socket.error): | ^^^^^^^^^^^^ PT011 25 | raise ValueError("Can't divide 1 by 0") @@ -39,7 +38,7 @@ PT011.py:35:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:38:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 36 | raise ValueError("Can't divide 1 by 0") -37 | +37 | 38 | with pytest.raises(ValueError, match=""): | ^^^^^^^^^^ PT011 39 | raise ValueError("Can't divide 1 by 0") @@ -48,7 +47,7 @@ PT011.py:38:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:41:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 39 | raise ValueError("Can't divide 1 by 0") -40 | +40 | 41 | with pytest.raises(ValueError, match=f""): | ^^^^^^^^^^ PT011 42 | raise ValueError("Can't divide 1 by 0") diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap index 1e03532e70..a256d35353 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_extend_broad_exceptions.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT011.py:13:24: PT011 `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception | @@ -21,7 +20,7 @@ PT011.py:18:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:21:43: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 19 | raise ValueError("Can't divide 1 by 0") -20 | +20 | 21 | with pytest.raises(expected_exception=ValueError): | ^^^^^^^^^^ PT011 22 | raise ValueError("Can't divide 1 by 0") @@ -30,7 +29,7 @@ PT011.py:21:43: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:24:24: PT011 `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception | 22 | raise ValueError("Can't divide 1 by 0") -23 | +23 | 24 | with pytest.raises(socket.error): | ^^^^^^^^^^^^ PT011 25 | raise ValueError("Can't divide 1 by 0") @@ -47,7 +46,7 @@ PT011.py:35:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:38:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 36 | raise ValueError("Can't divide 1 by 0") -37 | +37 | 38 | with pytest.raises(ValueError, match=""): | ^^^^^^^^^^ PT011 39 | raise ValueError("Can't divide 1 by 0") @@ -56,7 +55,7 @@ PT011.py:38:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:41:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 39 | raise ValueError("Can't divide 1 by 0") -40 | +40 | 41 | with pytest.raises(ValueError, match=f""): | ^^^^^^^^^^ PT011 42 | raise ValueError("Can't divide 1 by 0") diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap index 42cd9f1bdb..eb32dce4b1 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_all.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT011.py:13:24: PT011 `pytest.raises(ZeroDivisionError)` is too broad, set the `match` parameter or use a more specific exception | @@ -21,7 +20,7 @@ PT011.py:18:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:21:43: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 19 | raise ValueError("Can't divide 1 by 0") -20 | +20 | 21 | with pytest.raises(expected_exception=ValueError): | ^^^^^^^^^^ PT011 22 | raise ValueError("Can't divide 1 by 0") @@ -30,7 +29,7 @@ PT011.py:21:43: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:24:24: PT011 `pytest.raises(socket.error)` is too broad, set the `match` parameter or use a more specific exception | 22 | raise ValueError("Can't divide 1 by 0") -23 | +23 | 24 | with pytest.raises(socket.error): | ^^^^^^^^^^^^ PT011 25 | raise ValueError("Can't divide 1 by 0") @@ -39,7 +38,7 @@ PT011.py:24:24: PT011 `pytest.raises(socket.error)` is too broad, set the `match PT011.py:27:24: PT011 `pytest.raises(pickle.PicklingError)` is too broad, set the `match` parameter or use a more specific exception | 25 | raise ValueError("Can't divide 1 by 0") -26 | +26 | 27 | with pytest.raises(PicklingError): | ^^^^^^^^^^^^^ PT011 28 | raise PicklingError("Can't pickle") @@ -48,7 +47,7 @@ PT011.py:27:24: PT011 `pytest.raises(pickle.PicklingError)` is too broad, set th PT011.py:30:24: PT011 `pytest.raises(pickle.UnpicklingError)` is too broad, set the `match` parameter or use a more specific exception | 28 | raise PicklingError("Can't pickle") -29 | +29 | 30 | with pytest.raises(UnpicklingError): | ^^^^^^^^^^^^^^^ PT011 31 | raise UnpicklingError("Can't unpickle") @@ -65,7 +64,7 @@ PT011.py:35:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:38:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 36 | raise ValueError("Can't divide 1 by 0") -37 | +37 | 38 | with pytest.raises(ValueError, match=""): | ^^^^^^^^^^ PT011 39 | raise ValueError("Can't divide 1 by 0") @@ -74,7 +73,7 @@ PT011.py:38:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` PT011.py:41:24: PT011 `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception | 39 | raise ValueError("Can't divide 1 by 0") -40 | +40 | 41 | with pytest.raises(ValueError, match=f""): | ^^^^^^^^^^ PT011 42 | raise ValueError("Can't divide 1 by 0") diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap index 493e5b2a6f..418c5d5193 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT011_glob_prefix.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT011.py:27:24: PT011 `pytest.raises(pickle.PicklingError)` is too broad, set the `match` parameter or use a more specific exception | 25 | raise ValueError("Can't divide 1 by 0") -26 | +26 | 27 | with pytest.raises(PicklingError): | ^^^^^^^^^^^^^ PT011 28 | raise PicklingError("Can't pickle") @@ -14,7 +13,7 @@ PT011.py:27:24: PT011 `pytest.raises(pickle.PicklingError)` is too broad, set th PT011.py:30:24: PT011 `pytest.raises(pickle.UnpicklingError)` is too broad, set the `match` parameter or use a more specific exception | 28 | raise PicklingError("Can't pickle") -29 | +29 | 30 | with pytest.raises(UnpicklingError): | ^^^^^^^^^^^^^^^ PT011 31 | raise UnpicklingError("Can't unpickle") diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap index 9c7121756e..b4da53b527 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT013.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT013.py:11:1: PT013 Incorrect import of `pytest`; use `import pytest` instead | 9 | # Error -10 | +10 | 11 | import pytest as other_name | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT013 12 | from pytest import fixture diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT028.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT028.snap index 118bcac45c..88b10b57c9 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT028.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT028.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs PT028.py:3:16: PT028 Test function parameter `a` has default argument | 1 | # Errors -2 | +2 | 3 | def test_foo(a=1): ... | ^ PT028 4 | def test_foo(a = 1): ... diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_default.snap index caec785210..8e791ec77e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_default.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT030.py:16:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | @@ -13,7 +12,7 @@ PT030.py:16:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:19:40: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 17 | pass -18 | +18 | 19 | with pytest.warns(expected_warning=UserWarning): | ^^^^^^^^^^^ PT030 20 | pass @@ -30,7 +29,7 @@ PT030.py:27:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:30:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 28 | pass -29 | +29 | 30 | with pytest.warns(UserWarning, match=""): | ^^^^^^^^^^^ PT030 31 | pass @@ -39,7 +38,7 @@ PT030.py:30:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:33:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 31 | pass -32 | +32 | 33 | with pytest.warns(UserWarning, match=f""): | ^^^^^^^^^^^ PT030 34 | pass diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_extend_broad_exceptions.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_extend_broad_exceptions.snap index cfa437e824..7eaf4703e1 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_extend_broad_exceptions.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_extend_broad_exceptions.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT030.py:11:23: PT030 `pytest.warns(EncodingWarning)` is too broad, set the `match` parameter or use a more specific warning | @@ -21,7 +20,7 @@ PT030.py:16:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:19:40: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 17 | pass -18 | +18 | 19 | with pytest.warns(expected_warning=UserWarning): | ^^^^^^^^^^^ PT030 20 | pass @@ -38,7 +37,7 @@ PT030.py:27:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:30:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 28 | pass -29 | +29 | 30 | with pytest.warns(UserWarning, match=""): | ^^^^^^^^^^^ PT030 31 | pass @@ -47,7 +46,7 @@ PT030.py:30:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:33:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 31 | pass -32 | +32 | 33 | with pytest.warns(UserWarning, match=f""): | ^^^^^^^^^^^ PT030 34 | pass diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_all.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_all.snap index bda16efc4e..11c8873f1f 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_all.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_all.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT030.py:11:23: PT030 `pytest.warns(EncodingWarning)` is too broad, set the `match` parameter or use a more specific warning | @@ -21,7 +20,7 @@ PT030.py:16:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:19:40: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 17 | pass -18 | +18 | 19 | with pytest.warns(expected_warning=UserWarning): | ^^^^^^^^^^^ PT030 20 | pass @@ -30,7 +29,7 @@ PT030.py:19:40: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:22:23: PT030 `pytest.warns(foo.FooWarning)` is too broad, set the `match` parameter or use a more specific warning | 20 | pass -21 | +21 | 22 | with pytest.warns(FooWarning): | ^^^^^^^^^^ PT030 23 | pass @@ -47,7 +46,7 @@ PT030.py:27:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:30:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 28 | pass -29 | +29 | 30 | with pytest.warns(UserWarning, match=""): | ^^^^^^^^^^^ PT030 31 | pass @@ -56,7 +55,7 @@ PT030.py:30:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` PT030.py:33:23: PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning | 31 | pass -32 | +32 | 33 | with pytest.warns(UserWarning, match=f""): | ^^^^^^^^^^^ PT030 34 | pass diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_prefix.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_prefix.snap index 97a4e528eb..b939b1a658 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_prefix.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT030_glob_prefix.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs -snapshot_kind: text --- PT030.py:22:23: PT030 `pytest.warns(foo.FooWarning)` is too broad, set the `match` parameter or use a more specific warning | 20 | pass -21 | +21 | 22 | with pytest.warns(FooWarning): | ^^^^^^^^^^ PT030 23 | pass diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__is_pytest_test.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__is_pytest_test.snap index df63491d7e..66b3fc1395 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__is_pytest_test.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__is_pytest_test.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs is_pytest_test.py:3:27: PT028 Test function parameter `a` has default argument | 1 | # Errors -2 | +2 | 3 | def test_this_is_a_test(a=1): ... | ^ PT028 4 | def testThisIsAlsoATest(a=1): ... @@ -25,7 +25,7 @@ is_pytest_test.py:4:27: PT028 Test function parameter `a` has default argument 3 | def test_this_is_a_test(a=1): ... 4 | def testThisIsAlsoATest(a=1): ... | ^ PT028 -5 | +5 | 6 | class TestClass: | = help: Remove default argument diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap index 33c8d75e3f..39a104d5b5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- doubles_all.py:1:1: Q002 [*] Double quote docstring found but single quotes preferred | 1 | """This is a docstring.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Q002 -2 | +2 | 3 | this_is_an_inline_string = "double quote string" | = help: Replace double quotes docstring with single quotes diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap index 380c00dbba..617c8d4d99 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- doubles_all.py:3:28: Q000 [*] Double quotes found but single quotes preferred | 1 | """This is a docstring.""" -2 | +2 | 3 | this_is_an_inline_string = "double quote string" | ^^^^^^^^^^^^^^^^^^^^^ Q000 -4 | +4 | 5 | this_is_a_multiline_string = """ | = help: Replace double quotes with single quotes diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap index e290dfc0f2..2edceeb830 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- doubles_all.py:5:30: Q001 [*] Double quote multiline found but single quotes preferred | 3 | this_is_an_inline_string = "double quote string" -4 | +4 | 5 | this_is_a_multiline_string = """ | ______________________________^ 6 | | double quote string 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 5d977b04ba..400d7ae38e 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single quotes preferred | @@ -8,7 +7,7 @@ docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single 2 | """ Double quotes single line class docstring """ 3 | """ Not a docstring """ | ^^^^^^^^^^^^^^^^^^^^^^^ Q001 -4 | +4 | 5 | def foo(self, bar="""not a docstring"""): | = help: Replace double multiline quotes with single quotes @@ -25,7 +24,7 @@ docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but single quotes preferred | 3 | """ Not a docstring """ -4 | +4 | 5 | def foo(self, bar="""not a docstring"""): | ^^^^^^^^^^^^^^^^^^^^^ Q001 6 | """ Double quotes single line method docstring""" 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 5d6f9808eb..b4aa9a7b1f 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_module_singleline.py:2:1: Q001 [*] Double quote multiline found but single quotes preferred | 1 | """ Double quotes singleline module docstring """ 2 | """ this is not a docstring """ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q001 -3 | +3 | 4 | def foo(): | = help: Replace double multiline quotes with single quotes 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 9b31ff6866..b384b9e645 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_class.py:2:5: Q002 [*] Single quote docstring found but double quotes preferred | @@ -41,7 +40,7 @@ docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): ''' inline docstring '''; pass | ^^^^^^^^^^^^^^^^^^^^^^^^ Q002 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap index 89dbadf013..d231495a11 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_mixed_quotes_class_var_1.py:2:5: Q002 Single quote docstring found but double quotes preferred | @@ -59,7 +58,7 @@ docstring_singles_mixed_quotes_class_var_1.py:6:37: Q002 [*] Single quote docstr docstring_singles_mixed_quotes_class_var_1.py:9:29: Q002 Single quote docstring found but double quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass | ^^ Q002 | @@ -68,7 +67,7 @@ docstring_singles_mixed_quotes_class_var_1.py:9:29: Q002 Single quote docstring docstring_singles_mixed_quotes_class_var_1.py:9:57: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q002 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap index ee86ebe457..1346b4f188 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Single quote docstring found but double quotes preferred | @@ -77,7 +76,7 @@ docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstr docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass | ^^^^^^^^ Q002 | @@ -93,7 +92,7 @@ docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstr docstring_singles_mixed_quotes_class_var_2.py:9:64: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q002 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap index 0d3786a620..298bf7a6d1 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_mixed_quotes_module_singleline_var_1.py:1:1: Q002 Single quote docstring found but double quotes preferred | 1 | ''"Start with empty string" ' and lint docstring safely' | ^^ Q002 -2 | +2 | 3 | def foo(): | = help: Replace single quotes docstring with double quotes @@ -15,7 +14,7 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29: Q002 [*] Single | 1 | ''"Start with empty string" ' and lint docstring safely' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q002 -2 | +2 | 3 | def foo(): | = help: Replace single quotes docstring with double quotes diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap index 9037e28bbe..1faa802f1b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Single quote docstring found but double quotes preferred | 1 | 'Do not'" start with empty string" ' and lint docstring safely' | ^^^^^^^^ Q002 -2 | +2 | 3 | def foo(): | = help: Replace single quotes docstring with double quotes @@ -22,7 +21,7 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: Q002 [*] Single | 1 | 'Do not'" start with empty string" ' and lint docstring safely' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q002 -2 | +2 | 3 | def foo(): | = help: Replace single quotes docstring with double quotes 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 6c9201b6d2..e222557186 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_class.py:2:5: Q002 [*] Double quote docstring found but single quotes preferred | @@ -41,7 +40,7 @@ docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but single quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): """ inline docstring """; pass | ^^^^^^^^^^^^^^^^^^^^^^^^ Q002 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap index 8df5f7f4ee..34ed1310df 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_mixed_quotes_class_var_1.py:2:5: Q002 Double quote docstring found but single quotes preferred | @@ -23,7 +22,7 @@ docstring_doubles_mixed_quotes_class_var_1.py:6:9: Q002 Double quote docstring f docstring_doubles_mixed_quotes_class_var_1.py:9:29: Q002 Double quote docstring found but single quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): ""'Start with empty string' ' and lint docstring safely'; pass | ^^ Q002 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap index eef897e8a4..a9b6c90379 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Double quote docstring found but single quotes preferred | @@ -41,7 +40,7 @@ docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstri docstring_doubles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Double quote docstring found but single quotes preferred | 7 | pass -8 | +8 | 9 | class Nested(foo()[:]): "Do not"' start with empty string' ' and lint docstring safely'; pass | ^^^^^^^^ Q002 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap index 77d174d871..e19a8dabb2 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_1.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_mixed_quotes_module_singleline_var_1.py:1:1: Q002 Double quote docstring found but single quotes preferred | 1 | ""'Start with empty string' ' and lint docstring safely' | ^^ Q002 -2 | +2 | 3 | def foo(): | = help: Replace double quotes docstring with single quotes diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap index 8ff2ea1de0..81295100ba 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_doubles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Double quote docstring found but single quotes preferred | 1 | "Do not"' start with empty string' ' and lint docstring safely' | ^^^^^^^^ Q002 -2 | +2 | 3 | def foo(): | = help: Replace double quotes docstring with single quotes 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 b995da2bde..d94db3e564 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double quotes preferred | @@ -8,7 +7,7 @@ docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double 2 | ''' Double quotes single line class docstring ''' 3 | ''' Not a docstring ''' | ^^^^^^^^^^^^^^^^^^^^^^^ Q001 -4 | +4 | 5 | def foo(self, bar='''not a docstring'''): | = help: Replace single multiline quotes with double quotes @@ -25,7 +24,7 @@ docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but double quotes preferred | 3 | ''' Not a docstring ''' -4 | +4 | 5 | def foo(self, bar='''not a docstring'''): | ^^^^^^^^^^^^^^^^^^^^^ Q001 6 | ''' Double quotes single line method docstring''' 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 907da2954a..85b17d1d40 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- docstring_singles_module_singleline.py:2:1: Q001 [*] Single quote multiline found but double quotes preferred | 1 | ''' Double quotes singleline module docstring ''' 2 | ''' this is not a docstring ''' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q001 -3 | +3 | 4 | def foo(): | = help: Replace single multiline quotes with double quotes 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 b039517bb1..a1099a8e0b 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner quotes | @@ -125,7 +124,7 @@ singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu 32 | f"\"foo\" {f"foo"}" # Q003 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q003 -34 | +34 | 35 | f"normal {f"nested"} normal" | = help: Change outer quotes to avoid escaping inner quotes @@ -146,7 +145,7 @@ singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner q 32 | f"\"foo\" {f"foo"}" # Q003 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 | ^^^^^^^^^^ Q003 -34 | +34 | 35 | f"normal {f"nested"} normal" | = help: Change outer quotes to avoid escaping inner quotes diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap index abc266c155..71e3d38d97 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- singles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote character | @@ -164,7 +163,7 @@ singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote 32 | f"\'foo\' {f"foo"}" # Q004 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -34 | +34 | 35 | f"normal {f"nested"} normal" | = help: Remove backslash @@ -185,7 +184,7 @@ singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote 32 | f"\'foo\' {f"foo"}" # Q004 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 | ^^^^^^^^^^ Q004 -34 | +34 | 35 | f"normal {f"nested"} normal" | = help: Remove backslash @@ -287,7 +286,7 @@ singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -40 | +40 | 41 | # Make sure we do not unescape quotes | = help: Remove backslash @@ -308,7 +307,7 @@ singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -40 | +40 | 41 | # Make sure we do not unescape quotes | = help: Remove backslash @@ -329,7 +328,7 @@ singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote 42 | this_is_fine = "This is an \\'escaped\\' quote" 43 | this_should_raise_Q004 = "This is an \\\'escaped\\\' quote with an extra backslash" # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -44 | +44 | 45 | # Invalid escapes in bytestrings are also triggered: | = help: Remove backslash 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 ae82ed4e51..d926ca1c41 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- singles_multiline_string.py:1:5: Q001 [*] Single quote multiline found but double quotes preferred | @@ -9,7 +8,7 @@ singles_multiline_string.py:1:5: Q001 [*] Single quote multiline found but doubl 2 | | be 3 | | 'linted' ''' | |____________^ Q001 -4 | +4 | 5 | s = """ This 'should' | = help: Replace single multiline quotes with double quotes 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 11f9ea26d4..feff195fb7 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner quotes | @@ -164,7 +163,7 @@ doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner qu 34 | f'\'foo\' {f'nested'}' # Q003 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q003 -36 | +36 | 37 | f'normal {f'nested'} normal' | = help: Change outer quotes to avoid escaping inner quotes @@ -185,7 +184,7 @@ doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner q 34 | f'\'foo\' {f'nested'}' # Q003 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 | ^^^^^^^^^^^^^ Q003 -36 | +36 | 37 | f'normal {f'nested'} normal' | = help: Change outer quotes to avoid escaping inner quotes diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap index 23715cd437..3cf6da94bb 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- doubles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote character | @@ -205,7 +204,7 @@ doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote 34 | f'\"foo\" {f'nested'}' # Q004 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -36 | +36 | 37 | f'normal {f'nested'} normal' | = help: Remove backslash @@ -226,7 +225,7 @@ doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote 34 | f'\"foo\" {f'nested'}' # Q004 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 | ^^^^^^^^^^^^^ Q004 -36 | +36 | 37 | f'normal {f'nested'} normal' | = help: Remove backslash @@ -328,7 +327,7 @@ doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -42 | +42 | 43 | # Make sure we do not unescape quotes | = help: Remove backslash @@ -349,7 +348,7 @@ doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Q004 -42 | +42 | 43 | # Make sure we do not unescape quotes | = help: Remove backslash 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 3f3941f842..7d40683d00 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs -snapshot_kind: text --- doubles_multiline_string.py:1:5: Q001 [*] Double quote multiline found but single quotes preferred | @@ -9,7 +8,7 @@ doubles_multiline_string.py:1:5: Q001 [*] Double quote multiline found but singl 2 | | be 3 | | "linted" """ | |____________^ Q001 -4 | +4 | 5 | s = ''' This "should" | = help: Replace double multiline quotes with single quotes 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 be7643462e..80d7448df1 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_raise/mod.rs -snapshot_kind: text --- RSE102.py:5:21: RSE102 [*] Unnecessary parentheses on raised exception | @@ -8,7 +7,7 @@ RSE102.py:5:21: RSE102 [*] Unnecessary parentheses on raised exception 4 | # RSE102 5 | raise ValueError() | ^^ RSE102 -6 | +6 | 7 | try: | = help: Remove unnecessary parentheses @@ -28,7 +27,7 @@ RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception 12 | # RSE102 13 | raise TypeError() | ^^ RSE102 -14 | +14 | 15 | # RSE102 | = help: Remove unnecessary parentheses @@ -48,7 +47,7 @@ RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception 15 | # RSE102 16 | raise TypeError () | ^^ RSE102 -17 | +17 | 18 | # RSE102 | = help: Remove unnecessary parentheses @@ -69,7 +68,7 @@ RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception 19 | raise TypeError \ 20 | () | ^^ RSE102 -21 | +21 | 22 | # RSE102 | = help: Remove unnecessary parentheses @@ -90,7 +89,7 @@ RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception 23 | raise TypeError \ 24 | (); | ^^ RSE102 -25 | +25 | 26 | # RSE102 | = help: Remove unnecessary parentheses @@ -110,10 +109,10 @@ RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception 26 | # RSE102 27 | raise TypeError( | ________________^ -28 | | +28 | | 29 | | ) | |_^ RSE102 -30 | +30 | 31 | # RSE102 | = help: Remove unnecessary parentheses @@ -135,10 +134,10 @@ RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception 31 | # RSE102 32 | raise (TypeError) ( | ___________________^ -33 | | +33 | | 34 | | ) | |_^ RSE102 -35 | +35 | 36 | # RSE102 | = help: Remove unnecessary parentheses @@ -163,7 +162,7 @@ RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception 38 | | # Hello, world! 39 | | ) | |_^ RSE102 -40 | +40 | 41 | # OK | = help: Remove unnecessary parentheses @@ -185,7 +184,7 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception 73 | # RSE102 74 | raise IndexError()from ZeroDivisionError | ^^ RSE102 -75 | +75 | 76 | raise IndexError()\ | = help: Remove unnecessary parentheses @@ -203,7 +202,7 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception | 74 | raise IndexError()from ZeroDivisionError -75 | +75 | 76 | raise IndexError()\ | ^^ RSE102 77 | from ZeroDivisionError @@ -223,10 +222,10 @@ RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception | 77 | from ZeroDivisionError -78 | +78 | 79 | raise IndexError() from ZeroDivisionError | ^^ RSE102 -80 | +80 | 81 | raise IndexError(); | = help: Remove unnecessary parentheses @@ -244,10 +243,10 @@ RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception | 79 | raise IndexError() from ZeroDivisionError -80 | +80 | 81 | raise IndexError(); | ^^ RSE102 -82 | +82 | 83 | # RSE102 | = help: Remove unnecessary parentheses @@ -267,7 +266,7 @@ RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception 83 | # RSE102 84 | raise Foo() | ^^ RSE102 -85 | +85 | 86 | # OK | = help: Remove unnecessary parentheses 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 7660c5d800..0dcc8a8491 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs -snapshot_kind: text --- RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | @@ -27,7 +26,7 @@ RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is 13 | print(f"{key} not found") 14 | return None | ^^^^^^^^^^^ RET501 -15 | +15 | 16 | @property | = help: Remove explicit `return None` diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap index 5e412cfef1..132296938a 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET505_RET505.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs -snapshot_kind: text --- RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement | @@ -369,7 +368,7 @@ RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement 206 | return y 207 | else: | ^^^^ RET505 -208 | +208 | 209 | c = 3 | = help: Remove unnecessary `else` diff --git a/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap b/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap index 7dedeb769d..edd0ef3dd2 100644 --- a/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_self/snapshots/ruff_linter__rules__flake8_self__tests__private-member-access_SLF001.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_self/mod.rs -snapshot_kind: text --- SLF001.py:34:12: SLF001 Private member accessed: `_private` | @@ -44,7 +43,7 @@ SLF001.py:43:12: SLF001 Private member accessed: `_private_thing` SLF001.py:62:7: SLF001 Private member accessed: `_private_thing` | 60 | foo = Foo() -61 | +61 | 62 | print(foo._private_thing) # SLF001 | ^^^^^^^^^^^^^^^^^^ SLF001 63 | print(foo.__really_private_thing) # SLF001 @@ -105,6 +104,6 @@ SLF001.py:68:7: SLF001 Private member accessed: `_private_thing__` 67 | print(foo()._private_thing) # SLF001 68 | print(foo()._private_thing__) # SLF001 | ^^^^^^^^^^^^^^^^^^^^^^ SLF001 -69 | +69 | 70 | print(foo.public_thing) | 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 0a3979e46f..68fe445fbb 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -20,7 +19,7 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 2 | pass -3 | +3 | 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 5 | pass @@ -40,7 +39,7 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 5 | pass -6 | +6 | 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 8 | pass @@ -60,7 +59,7 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 8 | pass - 9 | + 9 | 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 11 | pass @@ -80,7 +79,7 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 14 | pass -15 | +15 | 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 17 | pass @@ -100,7 +99,7 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call | 17 | pass -18 | +18 | 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 20 | pass @@ -120,7 +119,7 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int SIM101.py:22:4: SIM101 Multiple `isinstance` calls for expression, merge into a single call | 20 | pass -21 | +21 | 22 | if isinstance(a(), int) or isinstance(a(), float): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 23 | pass @@ -130,7 +129,7 @@ SIM101.py:22:4: SIM101 Multiple `isinstance` calls for expression, merge into a SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 36 | pass -37 | +37 | 38 | if x or isinstance(a, int) or isinstance(a, float): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 39 | pass @@ -150,7 +149,7 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 39 | pass -40 | +40 | 41 | if x or y or isinstance(a, int) or isinstance(a, float) or z: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 42 | pass 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 d077e70063..ac36a3bf67 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` | 3 | # Bad 4 | os.environ['foo'] | ^^^^^ SIM112 -5 | +5 | 6 | os.environ.get('foo') | = help: Replace `foo` with `FOO` @@ -25,10 +24,10 @@ SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of SIM112.py:6:16: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 4 | os.environ['foo'] -5 | +5 | 6 | os.environ.get('foo') | ^^^^^ SIM112 -7 | +7 | 8 | os.environ.get('foo', 'bar') | = help: Replace `foo` with `FOO` @@ -36,10 +35,10 @@ SIM112.py:6:16: SIM112 Use capitalized environment variable `FOO` instead of `fo SIM112.py:8:16: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 6 | os.environ.get('foo') - 7 | + 7 | 8 | os.environ.get('foo', 'bar') | ^^^^^ SIM112 - 9 | + 9 | 10 | os.getenv('foo') | = help: Replace `foo` with `FOO` @@ -47,10 +46,10 @@ SIM112.py:8:16: SIM112 Use capitalized environment variable `FOO` instead of `fo SIM112.py:10:11: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 8 | os.environ.get('foo', 'bar') - 9 | + 9 | 10 | os.getenv('foo') | ^^^^^ SIM112 -11 | +11 | 12 | env = os.environ.get('foo') | = help: Replace `foo` with `FOO` @@ -58,10 +57,10 @@ SIM112.py:10:11: SIM112 Use capitalized environment variable `FOO` instead of `f SIM112.py:12:22: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 10 | os.getenv('foo') -11 | +11 | 12 | env = os.environ.get('foo') | ^^^^^ SIM112 -13 | +13 | 14 | env = os.environ['foo'] | = help: Replace `foo` with `FOO` @@ -69,10 +68,10 @@ SIM112.py:12:22: SIM112 Use capitalized environment variable `FOO` instead of `f SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` | 12 | env = os.environ.get('foo') -13 | +13 | 14 | env = os.environ['foo'] | ^^^^^ SIM112 -15 | +15 | 16 | if env := os.environ.get('foo'): | = help: Replace `foo` with `FOO` @@ -90,7 +89,7 @@ SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead o SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 14 | env = os.environ['foo'] -15 | +15 | 16 | if env := os.environ.get('foo'): | ^^^^^ SIM112 17 | pass @@ -100,7 +99,7 @@ SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `f SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` | 17 | pass -18 | +18 | 19 | if env := os.environ['foo']: | ^^^^^ SIM112 20 | pass diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap index 445f676694..551ddd0315 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM115_SIM115.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM115.py:8:5: SIM115 Use a context manager for opening files | @@ -57,14 +56,14 @@ SIM115.py:39:9: SIM115 Use a context manager for opening files 38 | with contextlib.ExitStack(): 39 | f = open("filename") | ^^^^ SIM115 -40 | +40 | 41 | # OK | SIM115.py:80:5: SIM115 Use a context manager for opening files | 78 | import fileinput -79 | +79 | 80 | f = tempfile.NamedTemporaryFile() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM115 81 | f = tempfile.TemporaryFile() @@ -305,7 +304,7 @@ SIM115.py:104:5: SIM115 Use a context manager for opening files 103 | f = fileinput.input("foo.txt") 104 | f = fileinput.FileInput("foo.txt") | ^^^^^^^^^^^^^^^^^^^ SIM115 -105 | +105 | 106 | with contextlib.suppress(Exception): | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap index fb7742657c..844e1906b4 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM116_SIM116.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM116.py:5:1: SIM116 Use a dictionary instead of consecutive `if` statements | @@ -14,7 +13,7 @@ SIM116.py:5:1: SIM116 Use a dictionary instead of consecutive `if` statements 11 | | else: 12 | | return 42 | |_____________^ SIM116 -13 | +13 | 14 | # SIM116 | @@ -30,7 +29,7 @@ SIM116.py:15:1: SIM116 Use a dictionary instead of consecutive `if` statements 21 | | else: 22 | | return (10, 11, 12) | |_______________________^ SIM116 -23 | +23 | 24 | # SIM116 | @@ -44,7 +43,7 @@ SIM116.py:25:1: SIM116 Use a dictionary instead of consecutive `if` statements 29 | | elif a == 3: 30 | | return (7, 8, 9) | |____________________^ SIM116 -31 | +31 | 32 | # SIM116 | @@ -60,7 +59,7 @@ SIM116.py:33:1: SIM116 Use a dictionary instead of consecutive `if` statements 39 | | else: 40 | | return (10, 11, 12) | |_______________________^ SIM116 -41 | +41 | 42 | # SIM116 | @@ -74,7 +73,7 @@ SIM116.py:43:1: SIM116 Use a dictionary instead of consecutive `if` statements 47 | | elif a == b"three": 48 | | return 3 | |____________^ SIM116 -49 | +49 | 50 | # SIM116 | @@ -90,7 +89,7 @@ SIM116.py:51:1: SIM116 Use a dictionary instead of consecutive `if` statements 57 | | else: 58 | | return (10, 11, 12) | |_______________________^ SIM116 -59 | +59 | 60 | # OK | @@ -106,6 +105,6 @@ SIM116.py:79:1: SIM116 Use a dictionary instead of consecutive `if` statements 85 | | elif func_name == "move": 86 | | return "MV" | |_______________^ SIM116 -87 | +87 | 88 | # OK | 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 2251effdcd..28b8ed5313 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 @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM118.py:3:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 1 | obj = {} -2 | +2 | 3 | key in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^ SIM118 -4 | +4 | 5 | key not in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -25,10 +24,10 @@ SIM118.py:3:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 3 | key in obj.keys() # SIM118 -4 | +4 | 5 | key not in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^ SIM118 -6 | +6 | 7 | foo["bar"] in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -46,10 +45,10 @@ SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 5 | key not in obj.keys() # SIM118 -6 | +6 | 7 | foo["bar"] in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -8 | +8 | 9 | foo["bar"] not in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -67,10 +66,10 @@ SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 7 | foo["bar"] in obj.keys() # SIM118 - 8 | + 8 | 9 | foo["bar"] not in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -10 | +10 | 11 | foo['bar'] in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -88,10 +87,10 @@ SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 9 | foo["bar"] not in obj.keys() # SIM118 -10 | +10 | 11 | foo['bar'] in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -12 | +12 | 13 | foo['bar'] not in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -109,10 +108,10 @@ SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 11 | foo['bar'] in obj.keys() # SIM118 -12 | +12 | 13 | foo['bar'] not in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -14 | +14 | 15 | foo() in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -130,10 +129,10 @@ SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 13 | foo['bar'] not in obj.keys() # SIM118 -14 | +14 | 15 | foo() in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^ SIM118 -16 | +16 | 17 | foo() not in obj.keys() # SIM118 | = help: Remove `.keys()` @@ -151,10 +150,10 @@ SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 15 | foo() in obj.keys() # SIM118 -16 | +16 | 17 | foo() not in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -18 | +18 | 19 | for key in obj.keys(): # SIM118 | = help: Remove `.keys()` @@ -172,7 +171,7 @@ SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 17 | foo() not in obj.keys() # SIM118 -18 | +18 | 19 | for key in obj.keys(): # SIM118 | ^^^^^^^^^^^^^^^^^ SIM118 20 | pass @@ -192,10 +191,10 @@ SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 24 | del obj[key] -25 | +25 | 26 | [k for k in obj.keys()] # SIM118 | ^^^^^^^^^^^^^^^ SIM118 -27 | +27 | 28 | {k for k in obj.keys()} # SIM118 | = help: Remove `.keys()` @@ -213,10 +212,10 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 26 | [k for k in obj.keys()] # SIM118 -27 | +27 | 28 | {k for k in obj.keys()} # SIM118 | ^^^^^^^^^^^^^^^ SIM118 -29 | +29 | 30 | {k: k for k in obj.keys()} # SIM118 | = help: Remove `.keys()` @@ -234,10 +233,10 @@ SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 28 | {k for k in obj.keys()} # SIM118 -29 | +29 | 30 | {k: k for k in obj.keys()} # SIM118 | ^^^^^^^^^^^^^^^ SIM118 -31 | +31 | 32 | (k for k in obj.keys()) # SIM118 | = help: Remove `.keys()` @@ -255,10 +254,10 @@ SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 30 | {k: k for k in obj.keys()} # SIM118 -31 | +31 | 32 | (k for k in obj.keys()) # SIM118 | ^^^^^^^^^^^^^^^ SIM118 -33 | +33 | 34 | key in (obj or {}).keys() # SIM118 | = help: Remove `.keys()` @@ -276,10 +275,10 @@ SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 32 | (k for k in obj.keys()) # SIM118 -33 | +33 | 34 | key in (obj or {}).keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -35 | +35 | 36 | (key) in (obj or {}).keys() # SIM118 | = help: Remove `.keys()` @@ -297,10 +296,10 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 34 | key in (obj or {}).keys() # SIM118 -35 | +35 | 36 | (key) in (obj or {}).keys() # SIM118 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM118 -37 | +37 | 38 | from typing import KeysView | = help: Remove `.keys()` @@ -361,7 +360,7 @@ SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 51 | (key in obj.keys())and foo 52 | key in (obj.keys())and foo | ^^^^^^^^^^^^^^^^^^^ SIM118 -53 | +53 | 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 | = help: Remove `.keys()` 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 df03a92a72..39455218cf 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` | @@ -20,7 +19,7 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | 2 | pass -3 | +3 | 4 | if not (not (a == b)): # SIM208 | ^^^^^^^^^^^^^^^^^^ SIM208 5 | pass @@ -40,10 +39,10 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | 14 | pass -15 | +15 | 16 | a = not not b # SIM208 | ^^^^^^^^^ SIM208 -17 | +17 | 18 | f(not not a) # SIM208 | = help: Replace with `b` @@ -61,10 +60,10 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | 16 | a = not not b # SIM208 -17 | +17 | 18 | f(not not a) # SIM208 | ^^^^^^^^^ SIM208 -19 | +19 | 20 | if 1 + (not (not a)): # SIM208 | = help: Replace with `a` @@ -82,7 +81,7 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | 18 | f(not not a) # SIM208 -19 | +19 | 20 | if 1 + (not (not a)): # SIM208 | ^^^^^^^^^^^ SIM208 21 | pass 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 3f510cfa80..3ccfac277d 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | 1 | a = True if b else False # SIM210 | ^^^^^^^^^^^^^^^^^^^^ SIM210 -2 | +2 | 3 | a = True if b != c else False # SIM210 | = help: Replace with `bool(...) @@ -21,10 +20,10 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | 1 | a = True if b else False # SIM210 -2 | +2 | 3 | a = True if b != c else False # SIM210 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM210 -4 | +4 | 5 | a = True if b + c else False # SIM210 | = help: Remove unnecessary `True if ... else False` @@ -41,10 +40,10 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | 3 | a = True if b != c else False # SIM210 -4 | +4 | 5 | a = True if b + c else False # SIM210 | ^^^^^^^^^^^^^^^^^^^^^^^^ SIM210 -6 | +6 | 7 | a = False if b else True # OK | = help: Replace with `bool(...) @@ -62,7 +61,7 @@ SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` SIM210.py:15:9: SIM210 Use `bool(...)` instead of `True if ... else False` | 13 | return False -14 | +14 | 15 | a = True if b else False | ^^^^^^^^^^^^^^^^^^^^ SIM210 | 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 d929bce24b..f064d0046f 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 | ^^^^^^^^^^^^^^^^^^^^ SIM211 -2 | +2 | 3 | a = False if b != c else True # SIM211 | = help: Replace with `not ...` @@ -21,10 +20,10 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 -2 | +2 | 3 | a = False if b != c else True # SIM211 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM211 -4 | +4 | 5 | a = False if b + c else True # SIM211 | = help: Replace with `not ...` @@ -41,10 +40,10 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 3 | a = False if b != c else True # SIM211 -4 | +4 | 5 | a = False if b + c else True # SIM211 | ^^^^^^^^^^^^^^^^^^^^^^^^ SIM211 -6 | +6 | 7 | a = True if b else False # OK | = help: Replace with `not ...` 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 e921f9fc83..8696c8e69d 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` | 1 | c = b if not a else a # SIM212 | ^^^^^^^^^^^^^^^^^ SIM212 -2 | +2 | 3 | c = b + c if not a else a # SIM212 | = help: Replace with `a if a else b` @@ -21,10 +20,10 @@ SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a else a` | 1 | c = b if not a else a # SIM212 -2 | +2 | 3 | c = b + c if not a else a # SIM212 | ^^^^^^^^^^^^^^^^^^^^^ SIM212 -4 | +4 | 5 | c = b if not x else a # OK | = help: Replace with `a if a else b + c` 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 631c661a83..a6a073846b 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` | @@ -20,7 +19,7 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | 2 | pass -3 | +3 | 4 | if (a and not a) and b: | ^^^^^^^^^^^ SIM220 5 | pass @@ -40,7 +39,7 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | 5 | pass -6 | +6 | 7 | if (a and not a) or b: | ^^^^^^^^^^^ SIM220 8 | pass 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 ae2354a7c6..d34af71f63 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` | @@ -20,7 +19,7 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | 2 | pass -3 | +3 | 4 | if (a or not a) or b: | ^^^^^^^^^^ SIM221 5 | pass @@ -40,7 +39,7 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | 5 | pass -6 | +6 | 7 | if (a or not a) and b: | ^^^^^^^^^^ SIM221 8 | pass 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 bf78eede11..f011dba942 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` | @@ -20,7 +19,7 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | 2 | pass -3 | +3 | 4 | if (a or b) or True: # SIM222 | ^^^^^^^^^^^^^^^^ SIM222 5 | pass @@ -40,7 +39,7 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | 5 | pass -6 | +6 | 7 | if a or (b or True): # SIM222 | ^^^^^^^^^ SIM222 8 | pass @@ -60,7 +59,7 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | 22 | pass -23 | +23 | 24 | if a or f() or True or g() or b: # SIM222 | ^^^^^^^^^^^^^^^^ SIM222 25 | pass @@ -80,7 +79,7 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | 25 | pass -26 | +26 | 27 | if True or f() or a or g() or b: # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 28 | pass @@ -100,7 +99,7 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | 28 | pass -29 | +29 | 30 | if a or True or f() or b or g(): # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 31 | pass @@ -121,7 +120,7 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | 47 | a or "" or True # SIM222 | ^^^^^^^^^^ SIM222 -48 | +48 | 49 | a or "foo" or True or "bar" # SIM222 | = help: Replace with `True` @@ -139,10 +138,10 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | 47 | a or "" or True # SIM222 -48 | +48 | 49 | a or "foo" or True or "bar" # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^ SIM222 -50 | +50 | 51 | a or 0 or True # SIM222 | = help: Replace with `"foo"` @@ -160,10 +159,10 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | 49 | a or "foo" or True or "bar" # SIM222 -50 | +50 | 51 | a or 0 or True # SIM222 | ^^^^^^^^^ SIM222 -52 | +52 | 53 | a or 1 or True or 2 # SIM222 | = help: Replace with `True` @@ -181,10 +180,10 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | 51 | a or 0 or True # SIM222 -52 | +52 | 53 | a or 1 or True or 2 # SIM222 | ^^^^^^^^^^^^^^ SIM222 -54 | +54 | 55 | a or 0.0 or True # SIM222 | = help: Replace with `1` @@ -202,10 +201,10 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | 53 | a or 1 or True or 2 # SIM222 -54 | +54 | 55 | a or 0.0 or True # SIM222 | ^^^^^^^^^^^ SIM222 -56 | +56 | 57 | a or 0.1 or True or 0.2 # SIM222 | = help: Replace with `True` @@ -223,10 +222,10 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | 55 | a or 0.0 or True # SIM222 -56 | +56 | 57 | a or 0.1 or True or 0.2 # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 -58 | +58 | 59 | a or [] or True # SIM222 | = help: Replace with `0.1` @@ -244,10 +243,10 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | 57 | a or 0.1 or True or 0.2 # SIM222 -58 | +58 | 59 | a or [] or True # SIM222 | ^^^^^^^^^^ SIM222 -60 | +60 | 61 | a or list([]) or True # SIM222 | = help: Replace with `True` @@ -265,10 +264,10 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | 59 | a or [] or True # SIM222 -60 | +60 | 61 | a or list([]) or True # SIM222 | ^^^^^^^^^^^^^^^^ SIM222 -62 | +62 | 63 | a or [1] or True or [2] # SIM222 | = help: Replace with `True` @@ -286,10 +285,10 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | 61 | a or list([]) or True # SIM222 -62 | +62 | 63 | a or [1] or True or [2] # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 -64 | +64 | 65 | a or list([1]) or True or list([2]) # SIM222 | = help: Replace with `[1]` @@ -307,10 +306,10 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | 63 | a or [1] or True or [2] # SIM222 -64 | +64 | 65 | a or list([1]) or True or list([2]) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -66 | +66 | 67 | a or {} or True # SIM222 | = help: Replace with `list([1])` @@ -328,10 +327,10 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | 65 | a or list([1]) or True or list([2]) # SIM222 -66 | +66 | 67 | a or {} or True # SIM222 | ^^^^^^^^^^ SIM222 -68 | +68 | 69 | a or dict() or True # SIM222 | = help: Replace with `True` @@ -349,10 +348,10 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | 67 | a or {} or True # SIM222 -68 | +68 | 69 | a or dict() or True # SIM222 | ^^^^^^^^^^^^^^ SIM222 -70 | +70 | 71 | a or {1: 1} or True or {2: 2} # SIM222 | = help: Replace with `True` @@ -370,10 +369,10 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | 69 | a or dict() or True # SIM222 -70 | +70 | 71 | a or {1: 1} or True or {2: 2} # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -72 | +72 | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 | = help: Replace with `{1: 1}` @@ -391,10 +390,10 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | 71 | a or {1: 1} or True or {2: 2} # SIM222 -72 | +72 | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -74 | +74 | 75 | a or set() or True # SIM222 | = help: Replace with `dict({1: 1})` @@ -412,10 +411,10 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 -74 | +74 | 75 | a or set() or True # SIM222 | ^^^^^^^^^^^^^ SIM222 -76 | +76 | 77 | a or set(set()) or True # SIM222 | = help: Replace with `True` @@ -433,10 +432,10 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | 75 | a or set() or True # SIM222 -76 | +76 | 77 | a or set(set()) or True # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 -78 | +78 | 79 | a or {1} or True or {2} # SIM222 | = help: Replace with `True` @@ -454,10 +453,10 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | 77 | a or set(set()) or True # SIM222 -78 | +78 | 79 | a or {1} or True or {2} # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 -80 | +80 | 81 | a or set({1}) or True or set({2}) # SIM222 | = help: Replace with `{1}` @@ -475,10 +474,10 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | 79 | a or {1} or True or {2} # SIM222 -80 | +80 | 81 | a or set({1}) or True or set({2}) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -82 | +82 | 83 | a or () or True # SIM222 | = help: Replace with `set({1})` @@ -496,10 +495,10 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | 81 | a or set({1}) or True or set({2}) # SIM222 -82 | +82 | 83 | a or () or True # SIM222 | ^^^^^^^^^^ SIM222 -84 | +84 | 85 | a or tuple(()) or True # SIM222 | = help: Replace with `True` @@ -517,10 +516,10 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | 83 | a or () or True # SIM222 -84 | +84 | 85 | a or tuple(()) or True # SIM222 | ^^^^^^^^^^^^^^^^^ SIM222 -86 | +86 | 87 | a or (1,) or True or (2,) # SIM222 | = help: Replace with `True` @@ -538,10 +537,10 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | 85 | a or tuple(()) or True # SIM222 -86 | +86 | 87 | a or (1,) or True or (2,) # SIM222 | ^^^^^^^^^^^^^^^^^^^^ SIM222 -88 | +88 | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 | = help: Replace with `(1,)` @@ -559,10 +558,10 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | 87 | a or (1,) or True or (2,) # SIM222 -88 | +88 | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -90 | +90 | 91 | a or frozenset() or True # SIM222 | = help: Replace with `tuple((1,))` @@ -580,10 +579,10 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 -90 | +90 | 91 | a or frozenset() or True # SIM222 | ^^^^^^^^^^^^^^^^^^^ SIM222 -92 | +92 | 93 | a or frozenset(frozenset()) or True # SIM222 | = help: Replace with `True` @@ -601,10 +600,10 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | 91 | a or frozenset() or True # SIM222 -92 | +92 | 93 | a or frozenset(frozenset()) or True # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -94 | +94 | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 | = help: Replace with `True` @@ -622,10 +621,10 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` | 93 | a or frozenset(frozenset()) or True # SIM222 -94 | +94 | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -96 | +96 | 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 | = help: Replace with `frozenset({1})` @@ -643,7 +642,7 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 -96 | +96 | 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM222 | @@ -662,10 +661,10 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | 100 | # Inside test `a` is simplified. -101 | +101 | 102 | bool(a or [1] or True or [2]) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -103 | +103 | 104 | assert a or [1] or True or [2] # SIM222 | = help: Replace with `True` @@ -683,10 +682,10 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | 102 | bool(a or [1] or True or [2]) # SIM222 -103 | +103 | 104 | assert a or [1] or True or [2] # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -105 | +105 | 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 | = help: Replace with `True` @@ -704,7 +703,7 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 -105 | +105 | 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM222 107 | pass @@ -724,7 +723,7 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 -105 | +105 | 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM222 107 | pass @@ -744,10 +743,10 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | 107 | pass -108 | +108 | 109 | 0 if a or [1] or True or [2] else 1 # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM222 -110 | +110 | 111 | while a or [1] or True or [2]: # SIM222 | = help: Replace with `True` @@ -765,7 +764,7 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -110 | +110 | 111 | while a or [1] or True or [2]: # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM222 112 | pass @@ -949,10 +948,10 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | 146 | # Outside test `a` is not simplified. -147 | +147 | 148 | a or [1] or True or [2] # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 -149 | +149 | 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 | = help: Replace with `[1]` @@ -970,7 +969,7 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | 148 | a or [1] or True or [2] # SIM222 -149 | +149 | 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 151 | pass @@ -990,7 +989,7 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | 151 | pass -152 | +152 | 153 | if f(a or [1] or True or [2]): # SIM222 | ^^^^^^^^^^^^^^^^^^ SIM222 154 | pass 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 7c83ffeb3c..5848727101 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` | @@ -20,7 +19,7 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | 2 | pass -3 | +3 | 4 | if (a or b) and False: # SIM223 | ^^^^^^^^^^^^^^^^^^ SIM223 5 | pass @@ -40,7 +39,7 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | 5 | pass -6 | +6 | 7 | if a or (b and False): # SIM223 | ^^^^^^^^^^^ SIM223 8 | pass @@ -60,7 +59,7 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | 17 | pass -18 | +18 | 19 | if a and f() and False and g() and b: # SIM223 | ^^^^^^^^^^^^^^^^^^^ SIM223 20 | pass @@ -80,7 +79,7 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | 20 | pass -21 | +21 | 22 | if False and f() and a and g() and b: # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 23 | pass @@ -100,7 +99,7 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | 23 | pass -24 | +24 | 25 | if a and False and f() and b and g(): # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 26 | pass @@ -121,7 +120,7 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | 42 | a and "" and False # SIM223 | ^^^^^^^^^^^^ SIM223 -43 | +43 | 44 | a and "foo" and False and "bar" # SIM223 | = help: Replace with `""` @@ -139,10 +138,10 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | 42 | a and "" and False # SIM223 -43 | +43 | 44 | a and "foo" and False and "bar" # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -45 | +45 | 46 | a and 0 and False # SIM223 | = help: Replace with `False` @@ -160,10 +159,10 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | 44 | a and "foo" and False and "bar" # SIM223 -45 | +45 | 46 | a and 0 and False # SIM223 | ^^^^^^^^^^^ SIM223 -47 | +47 | 48 | a and 1 and False and 2 # SIM223 | = help: Replace with `0` @@ -181,10 +180,10 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | 46 | a and 0 and False # SIM223 -47 | +47 | 48 | a and 1 and False and 2 # SIM223 | ^^^^^^^^^^^^^^^^^ SIM223 -49 | +49 | 50 | a and 0.0 and False # SIM223 | = help: Replace with `False` @@ -202,10 +201,10 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | 48 | a and 1 and False and 2 # SIM223 -49 | +49 | 50 | a and 0.0 and False # SIM223 | ^^^^^^^^^^^^^ SIM223 -51 | +51 | 52 | a and 0.1 and False and 0.2 # SIM223 | = help: Replace with `0.0` @@ -223,10 +222,10 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | 50 | a and 0.0 and False # SIM223 -51 | +51 | 52 | a and 0.1 and False and 0.2 # SIM223 | ^^^^^^^^^^^^^^^^^^^^^ SIM223 -53 | +53 | 54 | a and [] and False # SIM223 | = help: Replace with `False` @@ -244,10 +243,10 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | 52 | a and 0.1 and False and 0.2 # SIM223 -53 | +53 | 54 | a and [] and False # SIM223 | ^^^^^^^^^^^^ SIM223 -55 | +55 | 56 | a and list([]) and False # SIM223 | = help: Replace with `[]` @@ -265,10 +264,10 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | 54 | a and [] and False # SIM223 -55 | +55 | 56 | a and list([]) and False # SIM223 | ^^^^^^^^^^^^^^^^^^ SIM223 -57 | +57 | 58 | a and [1] and False and [2] # SIM223 | = help: Replace with `list([])` @@ -286,10 +285,10 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | 56 | a and list([]) and False # SIM223 -57 | +57 | 58 | a and [1] and False and [2] # SIM223 | ^^^^^^^^^^^^^^^^^^^^^ SIM223 -59 | +59 | 60 | a and list([1]) and False and list([2]) # SIM223 | = help: Replace with `False` @@ -307,10 +306,10 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | 58 | a and [1] and False and [2] # SIM223 -59 | +59 | 60 | a and list([1]) and False and list([2]) # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -61 | +61 | 62 | a and {} and False # SIM223 | = help: Replace with `False` @@ -328,10 +327,10 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | 60 | a and list([1]) and False and list([2]) # SIM223 -61 | +61 | 62 | a and {} and False # SIM223 | ^^^^^^^^^^^^ SIM223 -63 | +63 | 64 | a and dict() and False # SIM223 | = help: Replace with `{}` @@ -349,10 +348,10 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | 62 | a and {} and False # SIM223 -63 | +63 | 64 | a and dict() and False # SIM223 | ^^^^^^^^^^^^^^^^ SIM223 -65 | +65 | 66 | a and {1: 1} and False and {2: 2} # SIM223 | = help: Replace with `dict()` @@ -370,10 +369,10 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | 64 | a and dict() and False # SIM223 -65 | +65 | 66 | a and {1: 1} and False and {2: 2} # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -67 | +67 | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 | = help: Replace with `False` @@ -391,10 +390,10 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | 66 | a and {1: 1} and False and {2: 2} # SIM223 -67 | +67 | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -69 | +69 | 70 | a and set() and False # SIM223 | = help: Replace with `False` @@ -412,10 +411,10 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 -69 | +69 | 70 | a and set() and False # SIM223 | ^^^^^^^^^^^^^^^ SIM223 -71 | +71 | 72 | a and set(set()) and False # SIM223 | = help: Replace with `set()` @@ -433,10 +432,10 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | 70 | a and set() and False # SIM223 -71 | +71 | 72 | a and set(set()) and False # SIM223 | ^^^^^^^^^^^^^^^^^^^^ SIM223 -73 | +73 | 74 | a and {1} and False and {2} # SIM223 | = help: Replace with `set(set())` @@ -454,10 +453,10 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | 72 | a and set(set()) and False # SIM223 -73 | +73 | 74 | a and {1} and False and {2} # SIM223 | ^^^^^^^^^^^^^^^^^^^^^ SIM223 -75 | +75 | 76 | a and set({1}) and False and set({2}) # SIM223 | = help: Replace with `False` @@ -475,10 +474,10 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | 74 | a and {1} and False and {2} # SIM223 -75 | +75 | 76 | a and set({1}) and False and set({2}) # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -77 | +77 | 78 | a and () and False # SIM222 | = help: Replace with `False` @@ -496,10 +495,10 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | 76 | a and set({1}) and False and set({2}) # SIM223 -77 | +77 | 78 | a and () and False # SIM222 | ^^^^^^^^^^^^ SIM223 -79 | +79 | 80 | a and tuple(()) and False # SIM222 | = help: Replace with `()` @@ -517,10 +516,10 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | 78 | a and () and False # SIM222 -79 | +79 | 80 | a and tuple(()) and False # SIM222 | ^^^^^^^^^^^^^^^^^^^ SIM223 -81 | +81 | 82 | a and (1,) and False and (2,) # SIM222 | = help: Replace with `tuple(())` @@ -538,10 +537,10 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | 80 | a and tuple(()) and False # SIM222 -81 | +81 | 82 | a and (1,) and False and (2,) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -83 | +83 | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 | = help: Replace with `False` @@ -559,10 +558,10 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | 82 | a and (1,) and False and (2,) # SIM222 -83 | +83 | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -85 | +85 | 86 | a and frozenset() and False # SIM222 | = help: Replace with `False` @@ -580,10 +579,10 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 -85 | +85 | 86 | a and frozenset() and False # SIM222 | ^^^^^^^^^^^^^^^^^^^^^ SIM223 -87 | +87 | 88 | a and frozenset(frozenset()) and False # SIM222 | = help: Replace with `frozenset()` @@ -601,10 +600,10 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` | 86 | a and frozenset() and False # SIM222 -87 | +87 | 88 | a and frozenset(frozenset()) and False # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -89 | +89 | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 | = help: Replace with `frozenset(frozenset())` @@ -622,10 +621,10 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | 88 | a and frozenset(frozenset()) and False # SIM222 -89 | +89 | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -91 | +91 | 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 | = help: Replace with `False` @@ -643,7 +642,7 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 -91 | +91 | 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 | @@ -662,10 +661,10 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | 95 | # Inside test `a` is simplified. -96 | +96 | 97 | bool(a and [] and False and []) # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -98 | +98 | 99 | assert a and [] and False and [] # SIM223 | = help: Replace with `False` @@ -683,10 +682,10 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | 97 | bool(a and [] and False and []) # SIM223 - 98 | + 98 | 99 | assert a and [] and False and [] # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -100 | +100 | 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 | = help: Replace with `False` @@ -704,7 +703,7 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 -100 | +100 | 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 102 | pass @@ -724,7 +723,7 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 -100 | +100 | 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 102 | pass @@ -744,10 +743,10 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | 102 | pass -103 | +103 | 104 | 0 if a and [] and False and [] else 1 # SIM222 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 -105 | +105 | 106 | while a and [] and False and []: # SIM223 | = help: Replace with `False` @@ -765,7 +764,7 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | 104 | 0 if a and [] and False and [] else 1 # SIM222 -105 | +105 | 106 | while a and [] and False and []: # SIM223 | ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM223 107 | pass @@ -949,10 +948,10 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | 141 | # Outside test `a` is not simplified. -142 | +142 | 143 | a and [] and False and [] # SIM223 | ^^^^^^^^^^^^^^^^^^^ SIM223 -144 | +144 | 145 | if (a and [] and False and []) == (a and []): # SIM223 | = help: Replace with `[]` @@ -970,7 +969,7 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | 143 | a and [] and False and [] # SIM223 -144 | +144 | 145 | if (a and [] and False and []) == (a and []): # SIM223 | ^^^^^^^^^^^^^^^^^^^ SIM223 146 | pass @@ -990,7 +989,7 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | 146 | pass -147 | +147 | 148 | if f(a and [] and False and []): # SIM223 | ^^^^^^^^^^^^^^^^^^^ SIM223 149 | pass 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 677e4563de..4782624224 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM300.py:2:1: SIM300 [*] Yoda condition detected | @@ -318,7 +317,7 @@ SIM300.py:17:1: SIM300 [*] Yoda condition detected 16 | B or(B)2<>3<4'.split('<>') | ^^^^^^^^^^^^^^^^^^^^^^^ SIM905 -31 | +31 | 32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a '] | = help: Replace with list literal @@ -349,7 +348,7 @@ SIM905.py:30:1: SIM905 [*] Consider using a list literal instead of `str.split` SIM905.py:32:1: SIM905 [*] Consider using a list literal instead of `str.split` | 30 | '1<>2<>3<4'.split('<>') -31 | +31 | 32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a '] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905 33 | "".split() # [] @@ -536,7 +535,7 @@ SIM905.py:46:2: SIM905 [*] Consider using a list literal instead of `str.split` SIM905.py:53:1: SIM905 [*] Consider using a list literal instead of `str.split` | 51 | ) # ['a', 'b', 'c'] -52 | +52 | 53 | / "hello "\ 54 | | "world".split() | |___________________^ SIM905 @@ -748,7 +747,7 @@ SIM905.py:67:1: SIM905 [*] Consider using a list literal instead of `str.split` 66 | r"\n " "\n".split() # ['\\n'] 67 | "a " r"\n".split() # ['a', '\\n'] | ^^^^^^^^^^^^^^^^^^ SIM905 -68 | +68 | 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c'] | = help: Replace with list literal @@ -766,7 +765,7 @@ SIM905.py:67:1: SIM905 [*] Consider using a list literal instead of `str.split` SIM905.py:69:1: SIM905 [*] Consider using a list literal instead of `str.split` | 67 | "a " r"\n".split() # ['a', '\\n'] -68 | +68 | 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c'] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905 70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c'] @@ -830,7 +829,7 @@ SIM905.py:72:1: SIM905 [*] Consider using a list literal instead of `str.split` 71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c'] 72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c'] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905 -73 | +73 | 74 | # negatives | = help: Replace with list literal diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap index c43d1e140b..262e131eec 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM910_SIM910.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM910.py:2:1: SIM910 [*] Use `{}.get(key)` instead of `{}.get(key, None)` | 1 | # SIM910 2 | {}.get(key, None) | ^^^^^^^^^^^^^^^^^ SIM910 -3 | +3 | 4 | # SIM910 | = help: Replace `{}.get(key, None)` with `{}.get(key)` @@ -25,7 +24,7 @@ SIM910.py:5:1: SIM910 [*] Use `{}.get("key")` instead of `{}.get("key", None)` 4 | # SIM910 5 | {}.get("key", None) | ^^^^^^^^^^^^^^^^^^^ SIM910 -6 | +6 | 7 | # OK | = help: Replace `{}.get("key", None)` with `{}.get("key")` @@ -64,7 +63,7 @@ SIM910.py:24:5: SIM910 [*] Use `{}.get(key)` instead of `{}.get(key, None)` 23 | # SIM910 24 | a = {}.get(key, None) | ^^^^^^^^^^^^^^^^^ SIM910 -25 | +25 | 26 | # SIM910 | = help: Replace `{}.get(key, None)` with `{}.get(key)` @@ -84,7 +83,7 @@ SIM910.py:27:1: SIM910 [*] Use `({}).get(key)` instead of `({}).get(key, None)` 26 | # SIM910 27 | ({}).get(key, None) | ^^^^^^^^^^^^^^^^^^^ SIM910 -28 | +28 | 29 | # SIM910 | = help: Replace `({}).get(key, None)` with `({}).get(key)` @@ -105,7 +104,7 @@ SIM910.py:31:7: SIM910 [*] Use `ages.get("Cat")` instead of `ages.get("Cat", Non 30 | ages = {"Tom": 23, "Maria": 23, "Dog": 11} 31 | age = ages.get("Cat", None) | ^^^^^^^^^^^^^^^^^^^^^ SIM910 -32 | +32 | 33 | # OK | = help: Replace `ages.get("Cat", None)` with `ages.get("Cat")` @@ -126,7 +125,7 @@ SIM910.py:39:9: SIM910 [*] Use `kwargs.get('a')` instead of `kwargs.get('a', Non 38 | def foo(**kwargs): 39 | a = kwargs.get('a', None) | ^^^^^^^^^^^^^^^^^^^^^ SIM910 -40 | +40 | 41 | # SIM910 | = help: Replace `kwargs.get('a', None)` with `kwargs.get('a')` @@ -147,7 +146,7 @@ SIM910.py:43:9: SIM910 [*] Use `some_dict.get('a')` instead of `some_dict.get('a 42 | def foo(some_dict: dict): 43 | a = some_dict.get('a', None) | ^^^^^^^^^^^^^^^^^^^^^^^^ SIM910 -44 | +44 | 45 | # OK | = help: Replace `some_dict.get('a', None)` with `some_dict.get('a')` diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap index e94d188dd1..723cf6fa66 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM108_SIM108.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs -snapshot_kind: text --- SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block | @@ -10,7 +9,7 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i 4 | | else: 5 | | b = d | |_________^ SIM108 -6 | +6 | 7 | # OK | = help: Replace `if`-`else`-block with `b = c if a else d` @@ -30,8 +29,7 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` | 28 | pass 29 | else: -30 | if a: - | _____^ +30 | / if a: 31 | | b = 1 32 | | else: 33 | | b = 2 @@ -129,7 +127,7 @@ SIM108.py:141:1: SIM108 [*] Use binary operator `z = cond or other_cond` instead 143 | | else: 144 | | z = other_cond | |__________________^ SIM108 -145 | +145 | 146 | # SIM108 - should suggest | = help: Replace `if`-`else`-block with `z = cond or other_cond` @@ -156,7 +154,7 @@ SIM108.py:148:1: SIM108 [*] Use binary operator `z = cond and other_cond` instea 150 | | else: 151 | | z = other_cond | |__________________^ SIM108 -152 | +152 | 153 | # SIM108 - should suggest | = help: Replace `if`-`else`-block with `z = cond and other_cond` @@ -183,7 +181,7 @@ SIM108.py:155:1: SIM108 [*] Use binary operator `z = not cond and other_cond` in 157 | | else: 158 | | z = other_cond | |__________________^ SIM108 -159 | +159 | 160 | # SIM108 does not suggest | = help: Replace `if`-`else`-block with `z = not cond and other_cond` @@ -210,7 +208,7 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst 169 | | else: 170 | | z = other | |_____________^ SIM108 -171 | +171 | 172 | if False: | = help: Replace `if`-`else`-block with `z = 1 if True else other` @@ -231,13 +229,13 @@ SIM108.py:167:1: SIM108 [*] Use ternary operator `z = 1 if True else other` inst SIM108.py:177:1: SIM108 [*] Use ternary operator `z = True if 1 else other` instead of `if`-`else`-block | 175 | z = other -176 | +176 | 177 | / if 1: 178 | | z = True 179 | | else: 180 | | z = other | |_____________^ SIM108 -181 | +181 | 182 | # SIM108 does not suggest a binary option in this | = help: Replace `if`-`else`-block with `z = True if 1 else other` @@ -264,7 +262,7 @@ SIM108.py:185:1: SIM108 [*] Use ternary operator `z = foo() if foo() else other` 187 | | else: 188 | | z = other | |_____________^ SIM108 -189 | +189 | 190 | # SIM108 does not suggest a binary option in this | = help: Replace `if`-`else`-block with `z = foo() if foo() else other` diff --git a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap index d4bc0d6035..d2566de057 100644 --- a/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT001_SLOT001.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_slots/mod.rs -snapshot_kind: text --- SLOT001.py:1:7: SLOT001 Subclasses of `tuple` should define `__slots__` | @@ -26,7 +25,7 @@ SLOT001.py:16:7: SLOT001 Subclasses of `tuple` should define `__slots__` SLOT001.py:26:7: SLOT001 Subclasses of `tuple` should define `__slots__` | 24 | import builtins -25 | +25 | 26 | class AlsoBad(builtins.tuple[int, int]): # SLOT001 | ^^^^^^^ SLOT001 27 | pass diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap index 58146722da..652c0975bc 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs -snapshot_kind: text --- application.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules | 3 | import attrs -4 | +4 | 5 | from ....import unknown | ^^^^^^^^^^^^^^^^^^^^^^^ TID252 6 | from ..protocol import commands, definitions, responses diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap index 8f97c455d8..e74e8b7f3e 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api.snap @@ -1,33 +1,32 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs -snapshot_kind: text --- TID251.py:2:8: TID251 `cgi` is banned: The cgi module is deprecated. | 1 | ## Banned modules ## 2 | import cgi | ^^^ TID251 -3 | +3 | 4 | from cgi import * | TID251.py:4:1: TID251 `cgi` is banned: The cgi module is deprecated. | 2 | import cgi -3 | +3 | 4 | from cgi import * | ^^^^^^^^^^^^^^^^^ TID251 -5 | +5 | 6 | from cgi import a, b, c | TID251.py:6:1: TID251 `cgi` is banned: The cgi module is deprecated. | 4 | from cgi import * -5 | +5 | 6 | from cgi import a, b, c | ^^^^^^^^^^^^^^^^^^^^^^^ TID251 -7 | +7 | 8 | # banning a module also bans any submodules | @@ -36,37 +35,37 @@ TID251.py:9:8: TID251 `cgi` is banned: The cgi module is deprecated. 8 | # banning a module also bans any submodules 9 | import cgi.foo.bar | ^^^^^^^^^^^ TID251 -10 | +10 | 11 | from cgi.foo import bar | TID251.py:11:1: TID251 `cgi` is banned: The cgi module is deprecated. | 9 | import cgi.foo.bar -10 | +10 | 11 | from cgi.foo import bar | ^^^^^^^^^^^^^^^^^^^^^^^ TID251 -12 | +12 | 13 | from cgi.foo.bar import * | TID251.py:13:1: TID251 `cgi` is banned: The cgi module is deprecated. | 11 | from cgi.foo import bar -12 | +12 | 13 | from cgi.foo.bar import * | ^^^^^^^^^^^^^^^^^^^^^^^^^ TID251 -14 | +14 | 15 | ## Banned module members ## | TID251.py:17:20: TID251 `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. | 15 | ## Banned module members ## -16 | +16 | 17 | from typing import TypedDict | ^^^^^^^^^ TID251 -18 | +18 | 19 | import typing | @@ -75,17 +74,17 @@ TID251.py:22:1: TID251 `typing.TypedDict` is banned: Use typing_extensions.Typed 21 | # attribute access is checked 22 | typing.TypedDict | ^^^^^^^^^^^^^^^^ TID251 -23 | +23 | 24 | typing.TypedDict.anything | TID251.py:24:1: TID251 `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. | 22 | typing.TypedDict -23 | +23 | 24 | typing.TypedDict.anything | ^^^^^^^^^^^^^^^^ TID251 -25 | +25 | 26 | # function calls are checked | @@ -94,17 +93,17 @@ TID251.py:27:1: TID251 `typing.TypedDict` is banned: Use typing_extensions.Typed 26 | # function calls are checked 27 | typing.TypedDict() | ^^^^^^^^^^^^^^^^ TID251 -28 | +28 | 29 | typing.TypedDict.anything() | TID251.py:29:1: TID251 `typing.TypedDict` is banned: Use typing_extensions.TypedDict instead. | 27 | typing.TypedDict() -28 | +28 | 29 | typing.TypedDict.anything() | ^^^^^^^^^^^^^^^^ TID251 -30 | +30 | 31 | # import aliases are resolved | @@ -114,6 +113,6 @@ TID251.py:33:1: TID251 `typing.TypedDict` is banned: Use typing_extensions.Typed 32 | import typing as totally_not_typing 33 | totally_not_typing.TypedDict | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID251 -34 | +34 | 35 | # relative imports are respected | diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap index fd5b8bfe8b..47f5e38597 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_api_package.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs -snapshot_kind: text --- application.py:3:8: TID251 `attrs` is banned: The attrs module is deprecated. | 1 | from typing import TYPE_CHECKING, Any, ClassVar -2 | +2 | 3 | import attrs | ^^^^^ TID251 -4 | +4 | 5 | from ....import unknown | diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap index cf8a780c15..eb8c2d42a5 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__banned_module_level_imports.snap @@ -1,43 +1,42 @@ --- source: crates/ruff_linter/src/rules/flake8_tidy_imports/mod.rs -snapshot_kind: text --- TID253.py:2:8: TID253 `torch` is banned at the module level | 1 | ## Banned modules ## 2 | import torch | ^^^^^ TID253 -3 | +3 | 4 | from torch import * | TID253.py:4:1: TID253 `torch` is banned at the module level | 2 | import torch -3 | +3 | 4 | from torch import * | ^^^^^^^^^^^^^^^^^^^ TID253 -5 | +5 | 6 | from tensorflow import a, b, c | TID253.py:6:1: TID253 `tensorflow` is banned at the module level | 4 | from torch import * -5 | +5 | 6 | from tensorflow import a, b, c | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID253 -7 | +7 | 8 | import torch as torch_wearing_a_trenchcoat | TID253.py:8:8: TID253 `torch` is banned at the module level | 6 | from tensorflow import a, b, c - 7 | + 7 | 8 | import torch as torch_wearing_a_trenchcoat | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID253 - 9 | + 9 | 10 | # this should count as module level | @@ -46,7 +45,7 @@ TID253.py:11:15: TID253 `tensorflow` is banned at the module level 10 | # this should count as module level 11 | x = 1; import tensorflow | ^^^^^^^^^^ TID253 -12 | +12 | 13 | # banning a module also bans any submodules | @@ -55,26 +54,26 @@ TID253.py:14:8: TID253 `torch` is banned at the module level 13 | # banning a module also bans any submodules 14 | import torch.foo.bar | ^^^^^^^^^^^^^ TID253 -15 | +15 | 16 | from tensorflow.foo import bar | TID253.py:16:1: TID253 `tensorflow` is banned at the module level | 14 | import torch.foo.bar -15 | +15 | 16 | from tensorflow.foo import bar | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID253 -17 | +17 | 18 | from torch.foo.bar import * | TID253.py:18:1: TID253 `torch` is banned at the module level | 16 | from tensorflow.foo import bar -17 | +17 | 18 | from torch.foo.bar import * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID253 -19 | +19 | 20 | # unlike TID251, inline imports are *not* banned | diff --git a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap index 1b6f46ce5c..c381500f7c 100644 --- a/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_todos/snapshots/ruff_linter__rules__flake8_todos__tests__missing-todo-link_TD003.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_todos/mod.rs -snapshot_kind: text --- TD003.py:15:3: TD003 Missing issue link on the line following this TODO | @@ -13,7 +12,7 @@ TD003.py:15:3: TD003 Missing issue link on the line following this TODO TD003.py:18:3: TD003 Missing issue link on the line following this TODO | 16 | # link after it -17 | +17 | 18 | # TODO: here's a TODO with no link after it | ^^^^ TD003 19 | def foo(x): @@ -23,7 +22,7 @@ TD003.py:18:3: TD003 Missing issue link on the line following this TODO TD003.py:31:3: TD003 Missing issue link on the line following this TODO | 29 | # TDO-3870 -30 | +30 | 31 | # TODO: here's a TODO without an issue link | ^^^^ TD003 32 | # TODO: followed by a new TODO with an issue link @@ -33,17 +32,17 @@ TD003.py:31:3: TD003 Missing issue link on the line following this TODO TD003.py:35:9: TD003 Missing issue link on the line following this TODO | 33 | # TDO-3870 -34 | +34 | 35 | # foo # TODO: no link! | ^^^^ TD003 -36 | +36 | 37 | # TODO: here's a TODO on the last line with no link | TD003.py:37:3: TD003 Missing issue link on the line following this TODO | 35 | # foo # TODO: no link! -36 | +36 | 37 | # TODO: here's a TODO on the last line with no link | ^^^^ TD003 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap index 14fc75ff73..137f000062 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC005.py:4:5: TC005 [*] Found empty type-checking block | @@ -24,7 +23,7 @@ TC005.py:8:5: TC005 [*] Found empty type-checking block 7 | if False: 8 | pass # TC005 | ^^^^ TC005 - 9 | + 9 | 10 | if 0: | = help: Delete empty type-checking block @@ -102,7 +101,7 @@ TC005.py:45:5: TC005 [*] Found empty type-checking block 44 | if TYPE_CHECKING: 45 | pass # TC005 | ^^^^ TC005 -46 | +46 | 47 | # https://github.com/astral-sh/ruff/issues/11368 | = help: Delete empty type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap index 215264924b..8681340443 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- exempt_modules.py:14:12: TC002 [*] Move third-party import `flask` into a type-checking block | 13 | def f(): 14 | import flask | ^^^^^ TC002 -15 | +15 | 16 | x: flask | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap index e8300136de..2e46ea78ae 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:8: TC003 [*] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import os, pandas | ^^ TC003 -7 | +7 | 8 | def f(x: os, y: pandas): | = help: Move into type-checking block @@ -29,10 +28,10 @@ snapshot_kind: text :6:12: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import os, pandas | ^^^^^^ TC002 -7 | +7 | 8 | def f(x: os, y: pandas): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap index aa2a82e116..4b1eeaaeb9 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:8: TC003 [*] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import os, sys | ^^ TC003 -7 | +7 | 8 | def f(x: os, y: sys): | = help: Move into type-checking block @@ -28,10 +27,10 @@ snapshot_kind: text :6:12: TC003 [*] Move standard library import `sys` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import os, sys | ^^^ TC003 -7 | +7 | 8 | def f(x: os, y: sys): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap index 8b3c5b1c1a..5b14c673f9 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :4:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations -3 | +3 | 4 | import pandas as pd | ^^ TC002 -5 | +5 | 6 | def f(x: pd.DataFrame): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap index c782c1ec08..658646b7c2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap @@ -6,7 +6,7 @@ quote.py:57:28: TC004 [*] Quote references to `pandas.DataFrame`. Import is in a 56 | if TYPE_CHECKING: 57 | from pandas import DataFrame | ^^^^^^^^^ TC004 -58 | +58 | 59 | def func(value: DataFrame): | = help: Quote references @@ -26,7 +26,7 @@ quote.py:110:28: TC004 [*] Move import `pandas.DataFrame` out of type-checking b 109 | if TYPE_CHECKING: 110 | from pandas import DataFrame | ^^^^^^^^^ TC004 -111 | +111 | 112 | x: TypeAlias = DataFrame | None | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap index 593464accb..89ab3746f0 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- quote.py:2:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 1 | def f(): 2 | from pandas import DataFrame | ^^^^^^^^^ TC002 -3 | +3 | 4 | def baz() -> DataFrame: | = help: Move into type-checking block @@ -31,7 +30,7 @@ quote.py:9:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type- 8 | def f(): 9 | from pandas import DataFrame | ^^^^^^^^^ TC002 -10 | +10 | 11 | def baz() -> DataFrame[int]: | = help: Move into type-checking block @@ -61,7 +60,7 @@ quote.py:16:22: TC002 [*] Move third-party import `pandas` into a type-checking 15 | def f(): 16 | import pandas as pd | ^^ TC002 -17 | +17 | 18 | def baz() -> pd.DataFrame: | = help: Move into type-checking block @@ -91,7 +90,7 @@ quote.py:23:22: TC002 [*] Move third-party import `pandas` into a type-checking 22 | def f(): 23 | import pandas as pd | ^^ TC002 -24 | +24 | 25 | def baz() -> pd.DataFrame.Extra: | = help: Move into type-checking block @@ -121,7 +120,7 @@ quote.py:30:22: TC002 [*] Move third-party import `pandas` into a type-checking 29 | def f(): 30 | import pandas as pd | ^^ TC002 -31 | +31 | 32 | def baz() -> pd.DataFrame | int: | = help: Move into type-checking block @@ -151,7 +150,7 @@ quote.py:38:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type 37 | def f(): 38 | from pandas import DataFrame | ^^^^^^^^^ TC002 -39 | +39 | 40 | def baz() -> DataFrame(): | = help: Move into type-checking block @@ -179,10 +178,10 @@ quote.py:38:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type quote.py:47:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 45 | from typing import Literal -46 | +46 | 47 | from pandas import DataFrame | ^^^^^^^^^ TC002 -48 | +48 | 49 | def baz() -> DataFrame[Literal["int"]]: | = help: Move into type-checking block @@ -212,7 +211,7 @@ quote.py:64:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type 63 | def f(): 64 | from pandas import DataFrame, Series | ^^^^^^^^^ TC002 -65 | +65 | 66 | def baz() -> DataFrame | Series: | = help: Move into type-checking block @@ -242,7 +241,7 @@ quote.py:64:35: TC002 [*] Move third-party import `pandas.Series` into a type-ch 63 | def f(): 64 | from pandas import DataFrame, Series | ^^^^^^ TC002 -65 | +65 | 66 | def baz() -> DataFrame | Series: | = help: Move into type-checking block @@ -272,7 +271,7 @@ quote.py:71:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type 70 | def f(): 71 | from pandas import DataFrame, Series | ^^^^^^^^^ TC002 -72 | +72 | 73 | def baz() -> ( | = help: Move into type-checking block @@ -315,7 +314,7 @@ quote.py:71:35: TC002 [*] Move third-party import `pandas.Series` into a type-ch 70 | def f(): 71 | from pandas import DataFrame, Series | ^^^^^^ TC002 -72 | +72 | 73 | def baz() -> ( | = help: Move into type-checking block @@ -358,7 +357,7 @@ quote.py:89:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type 88 | def f(): 89 | from pandas import DataFrame, Series | ^^^^^^^^^ TC002 -90 | +90 | 91 | def func(self) -> DataFrame | list[Series]: | = help: Move into type-checking block @@ -388,7 +387,7 @@ quote.py:89:35: TC002 [*] Move third-party import `pandas.Series` into a type-ch 88 | def f(): 89 | from pandas import DataFrame, Series | ^^^^^^ TC002 -90 | +90 | 91 | def func(self) -> DataFrame | list[Series]: | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap index 7401bf3092..747fe681cc 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- quote2.py:2:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 1 | def f(): 2 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -3 | +3 | 4 | def test_remove_inner_quotes_double(self, user: AbstractBaseUser["int"]): | = help: Move into type-checking block @@ -31,7 +30,7 @@ quote2.py:9:44: TC002 [*] Move third-party import `django.contrib.auth.models.Ab 8 | def f(): 9 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -10 | +10 | 11 | def test_remove_inner_quotes_single(self, user: AbstractBaseUser['int']): | = help: Move into type-checking block @@ -61,7 +60,7 @@ quote2.py:16:44: TC002 [*] Move third-party import `django.contrib.auth.models.A 15 | def f(): 16 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -17 | +17 | 18 | def test_remove_inner_quotes_mixed(self, user: AbstractBaseUser['int', "str"]): | = help: Move into type-checking block @@ -89,10 +88,10 @@ quote2.py:16:44: TC002 [*] Move third-party import `django.contrib.auth.models.A quote2.py:25:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 23 | from typing import Annotated, Literal -24 | +24 | 25 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -26 | +26 | 27 | def test_literal_annotation_args_contain_quotes(self, type1: AbstractBaseUser[Literal["user", "admin"], Annotated["int", "1", 2]]): | = help: Move into type-checking block @@ -120,10 +119,10 @@ quote2.py:25:44: TC002 [*] Move third-party import `django.contrib.auth.models.A quote2.py:34:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 32 | from typing import Literal -33 | +33 | 34 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -35 | +35 | 36 | def test_union_contain_inner_quotes(self, type1: AbstractBaseUser["int" | Literal["int"]]): | = help: Move into type-checking block @@ -151,10 +150,10 @@ quote2.py:34:44: TC002 [*] Move third-party import `django.contrib.auth.models.A quote2.py:43:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 41 | from typing import Literal -42 | +42 | 43 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -44 | +44 | 45 | def test_inner_literal_mixed_quotes(user: AbstractBaseUser[Literal['user', "admin"]]): | = help: Move into type-checking block @@ -182,10 +181,10 @@ quote2.py:43:44: TC002 [*] Move third-party import `django.contrib.auth.models.A quote2.py:52:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 50 | from typing import Literal -51 | +51 | 52 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -53 | +53 | 54 | def test_inner_literal_single_quote(user: AbstractBaseUser[Literal['int'], str]): | = help: Move into type-checking block @@ -213,10 +212,10 @@ quote2.py:52:44: TC002 [*] Move third-party import `django.contrib.auth.models.A quote2.py:61:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 59 | from typing import Literal -60 | +60 | 61 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -62 | +62 | 63 | def test_mixed_quotes_literal(user: AbstractBaseUser[Literal['user'], "int"]): | = help: Move into type-checking block @@ -244,10 +243,10 @@ quote2.py:61:44: TC002 [*] Move third-party import `django.contrib.auth.models.A quote2.py:70:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 68 | from typing import Annotated, Literal -69 | +69 | 70 | from django.contrib.auth.models import AbstractBaseUser | ^^^^^^^^^^^^^^^^ TC002 -71 | +71 | 72 | def test_annotated_literal_mixed_quotes(user: AbstractBaseUser[Annotated[str, "max_length=20", Literal['user', "admin"]]]): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008.py.snap index 76545b56fd..626c985dbe 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs TC008.py:15:16: TC008 [*] Remove quotes from type alias | 13 | Bar = Foo -14 | +14 | 15 | a: TypeAlias = 'int' # TC008 | ^^^^^ TC008 16 | b: TypeAlias = 'Dict' # OK @@ -156,7 +156,7 @@ TC008.py:29:17: TC008 [*] Remove quotes from type alias | _________________^ 30 | | ' | None') | |_____________^ TC008 -31 | +31 | 32 | type B = 'Dict' # TC008 | = help: Remove quotes @@ -175,7 +175,7 @@ TC008.py:29:17: TC008 [*] Remove quotes from type alias TC008.py:32:10: TC008 [*] Remove quotes from type alias | 30 | ' | None') -31 | +31 | 32 | type B = 'Dict' # TC008 | ^^^^^^ TC008 33 | type D = 'Foo[str]' # TC008 @@ -388,7 +388,7 @@ TC008.py:48:14: TC008 [*] Remove quotes from type alias 47 | a: TypeAlias = 'Baz' # OK 48 | type A = 'Baz' # TC008 | ^^^^^ TC008 -49 | +49 | 50 | class Nested: | = help: Remove quotes diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008_typing_execution_context.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008_typing_execution_context.py.snap index 0da908ea8e..c3b71b50de 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008_typing_execution_context.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quoted-type-alias_TC008_typing_execution_context.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs TC008_typing_execution_context.py:13:20: TC008 [*] Remove quotes from type alias | 11 | Bar: TypeAlias = Foo[int] -12 | +12 | 13 | a: TypeAlias = 'int' # TC008 | ^^^^^ TC008 14 | b: TypeAlias = 'Dict' # TC008 diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap index 74ba7d464e..b9858550b2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC004_11.py:4:24: TC004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List | ^^^^ TC004 -5 | +5 | 6 | __all__ = ("List",) | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap index 9d22eb24bf..52ee66998c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC004_12.py:6:33: TC004 [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. | 5 | if TYPE_CHECKING: 6 | from collections.abc import Callable | ^^^^^^^^ TC004 -7 | +7 | 8 | AnyCallable: TypeAlias = Callable[..., Any] | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap index 765fd57c61..29514c37a1 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC004_9.py:4:24: TC004 [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict | ^^^^^ TC004 -5 | +5 | 6 | x: Tuple | = help: Move out of type-checking block @@ -28,7 +27,7 @@ TC004_9.py:4:31: TC004 [*] Move import `typing.List` out of type-checking block. 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict | ^^^^ TC004 -5 | +5 | 6 | x: Tuple | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_module__app.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_module__app.py.snap index 8c73eb30ad..436e35992b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_module__app.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_module__app.py.snap @@ -28,7 +28,7 @@ app.py:10:23: TC004 [*] Move import `array.array` out of type-checking block. Im 9 | import datetime # TC004 10 | from array import array # TC004 | ^^^^^ TC004 -11 | +11 | 12 | app = fastapi.FastAPI("First application") | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap index 4d4f252faf..dbb418b692 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap @@ -6,7 +6,7 @@ quote.py:57:28: TC004 [*] Move import `pandas.DataFrame` out of type-checking bl 56 | if TYPE_CHECKING: 57 | from pandas import DataFrame | ^^^^^^^^^ TC004 -58 | +58 | 59 | def func(value: DataFrame): | = help: Move out of type-checking block @@ -31,7 +31,7 @@ quote.py:110:28: TC004 [*] Move import `pandas.DataFrame` out of type-checking b 109 | if TYPE_CHECKING: 110 | from pandas import DataFrame | ^^^^^^^^^ TC004 -111 | +111 | 112 | x: TypeAlias = DataFrame | None | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap index 689abb0884..70d301b0b5 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- runtime_evaluated_base_classes_1.py:10:12: TC004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | @@ -29,7 +28,7 @@ runtime_evaluated_base_classes_1.py:11:23: TC004 [*] Move import `array.array` o 10 | import datetime # TC004 11 | from array import array # TC004 | ^^^^^ TC004 -12 | +12 | 13 | import pandas # TC004 | = help: Move out of type-checking block @@ -50,7 +49,7 @@ runtime_evaluated_base_classes_1.py:11:23: TC004 [*] Move import `array.array` o runtime_evaluated_base_classes_1.py:13:12: TC004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 11 | from array import array # TC004 -12 | +12 | 13 | import pandas # TC004 | ^^^^^^ TC004 14 | import pyproj diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap index e0a3725545..bab0a4ba63 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- runtime_evaluated_decorators_1.py:12:12: TC004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | @@ -29,7 +28,7 @@ runtime_evaluated_decorators_1.py:13:23: TC004 [*] Move import `array.array` out 12 | import datetime # TC004 13 | from array import array # TC004 | ^^^^^ TC004 -14 | +14 | 15 | import pandas # TC004 | = help: Move out of type-checking block @@ -50,7 +49,7 @@ runtime_evaluated_decorators_1.py:13:23: TC004 [*] Move import `array.array` out runtime_evaluated_decorators_1.py:15:12: TC004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 13 | from array import array # TC004 -14 | +14 | 15 | import pandas # TC004 | ^^^^^^ TC004 16 | import pyproj diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap index c4db736188..364d44103b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC010_1.py:18:30: TC010 Invalid string member in `X | Y`-style union type | 16 | type A = Value["int" | str] # OK -17 | +17 | 18 | OldS = TypeVar('OldS', int | 'str', str) # TC010 | ^^^^^ TC010 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap index 2dc80f40e2..1e169cb50c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC010_2.py:4:4: TC010 Invalid string member in `X | Y`-style union type | @@ -27,14 +26,14 @@ TC010_2.py:12:20: TC010 Invalid string member in `X | Y`-style union type | 12 | z: list[str, str | "int"] = [] # TC010 | ^^^^^ TC010 -13 | +13 | 14 | type A = Value["int" | str] # OK | TC010_2.py:16:30: TC010 Invalid string member in `X | Y`-style union type | 14 | type A = Value["int" | str] # OK -15 | +15 | 16 | OldS = TypeVar('OldS', int | 'str', str) # TC010 | ^^^^^ TC010 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap index 35e5ef0a4e..b5260d86db 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- init_var.py:5:25: TC003 [*] Move standard library import `dataclasses.FrozenInstanceError` into a type-checking block | 3 | from __future__ import annotations -4 | +4 | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass | ^^^^^^^^^^^^^^^^^^^ TC003 6 | from pathlib import Path diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap index 08742fa65e..541a83ad17 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- kw_only.py:5:45: TC003 [*] Move standard library import `dataclasses.Field` into a type-checking block | 3 | from __future__ import annotations -4 | +4 | 5 | from dataclasses import KW_ONLY, dataclass, Field | ^^^^^ TC003 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap index ca5ceb2983..d8451b6dfb 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- strict.py:27:21: TC002 [*] Move third-party import `pkg.A` into a type-checking block | @@ -8,7 +7,7 @@ strict.py:27:21: TC002 [*] Move third-party import `pkg.A` into a type-checking 26 | import pkg 27 | from pkg import A | ^ TC002 -28 | +28 | 29 | def test(value: A): | = help: Move into type-checking block @@ -37,7 +36,7 @@ strict.py:35:21: TC002 [*] Move third-party import `pkg.A` into a type-checking 34 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 35 | from pkg import A, B | ^ TC002 -36 | +36 | 37 | def test(value: A): | = help: Move into type-checking block @@ -67,7 +66,7 @@ strict.py:54:25: TC002 [*] Move third-party import `pkg.bar.A` into a type-check 53 | import pkg 54 | from pkg.bar import A | ^ TC002 -55 | +55 | 56 | def test(value: A): | = help: Move into type-checking block @@ -208,7 +207,7 @@ strict.py:101:23: TC002 [*] Move third-party import `pkg.foo` into a type-checki 100 | import pkg.bar as B 101 | import pkg.foo as F | ^ TC002 -102 | +102 | 103 | def test(value: F.Foo): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc004_precedence_over_tc007.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc004_precedence_over_tc007.snap index 41b0f9408f..b4ae0f7ff9 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc004_precedence_over_tc007.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc004_precedence_over_tc007.snap @@ -7,7 +7,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 5 | if TYPE_CHECKING: 6 | from foo import Foo # TC004 | ^^^ TC004 -7 | +7 | 8 | a: TypeAlias = Foo | None # OK | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc010_precedence_over_tc008.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc010_precedence_over_tc008.snap index 2d30b115db..3f7510c00f 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc010_precedence_over_tc008.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__tc010_precedence_over_tc008.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs :6:16: TC008 [*] Remove quotes from type alias | 4 | from typing import TypeAlias -5 | +5 | 6 | a: TypeAlias = 'int | None' # TC008 | ^^^^^^^^^^^^ TC008 7 | b: TypeAlias = 'int' | None # TC010 diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap index 23e2c0e0ff..cdacd1ba29 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import pandas as pd | ^^ TC002 -7 | +7 | 8 | def f(x: pd.DataFrame): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap index 06cc0d4700..ce5864c57d 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import pandas as pd | ^^ TC002 -7 | +7 | 8 | if TYPE_CHECKING: | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap index 946226bbec..bafccc1d13 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import pandas as pd | ^^ TC002 -7 | +7 | 8 | if TYPE_CHECKING: import os | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap index ecb1a3e892..ac2f55bc5a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import pandas as pd | ^^ TC002 -7 | +7 | 8 | if TYPE_CHECKING: | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap index 3ea3a853b8..cc9d12d169 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC001.py:20:19: TC001 [*] Move application import `.TYP001` into a type-checking block | 19 | def f(): 20 | from . import TYP001 | ^^^^^^ TC001 -21 | +21 | 22 | x: TYP001 | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap index d527f4ccb1..e7590ea5c2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC003.py:8:12: TC003 [*] Move standard library import `os` into a type-checking block | 7 | def f(): 8 | import os | ^^ TC003 - 9 | + 9 | 10 | x: os | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap index 0e97a46464..98f48ef06a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- exempt_type_checking_1.py:5:20: TC003 [*] Move standard library import `typing.Final` into a type-checking block | 3 | from __future__ import annotations -4 | +4 | 5 | from typing import Final | ^^^^^ TC003 -6 | +6 | 7 | Const: Final[dict] = {} | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap index 32cf29f776..909e0d5530 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- exempt_type_checking_2.py:5:20: TC003 [*] Move standard library import `typing.Final` into a type-checking block | 3 | from __future__ import annotations -4 | +4 | 5 | from typing import Final, TYPE_CHECKING | ^^^^^ TC003 -6 | +6 | 7 | Const: Final[dict] = {} | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap index c93a7aba9a..afd7480ade 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- exempt_type_checking_3.py:5:20: TC003 [*] Move standard library import `typing.Final` into a type-checking block | 3 | from __future__ import annotations -4 | +4 | 5 | from typing import Final, Mapping | ^^^^^ TC003 -6 | +6 | 7 | Const: Final[dict] = {} | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap index 490c756534..89f0a91947 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- undefined.py:3:29: TC003 [*] Move standard library import `collections.abc.Sequence` into a type-checking block | 1 | from __future__ import annotations -2 | +2 | 3 | from collections.abc import Sequence | ^^^^^^^^ TC003 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap index 95cf17c162..06d344ed01 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- runtime_evaluated_base_classes_3.py:5:18: TC003 [*] Move standard library import `uuid.UUID` into a type-checking block | @@ -8,7 +7,7 @@ runtime_evaluated_base_classes_3.py:5:18: TC003 [*] Move standard library import 4 | import pathlib 5 | from uuid import UUID # TC003 | ^^^^ TC003 -6 | +6 | 7 | import pydantic | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap index 3c59bc98ee..3b34f3141c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- TC002.py:5:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | def f(): 5 | import pandas as pd # TC002 | ^^ TC002 -6 | +6 | 7 | x: pd.DataFrame | = help: Move into type-checking block @@ -31,7 +30,7 @@ TC002.py:11:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type 10 | def f(): 11 | from pandas import DataFrame # TC002 | ^^^^^^^^^ TC002 -12 | +12 | 13 | x: DataFrame | = help: Move into type-checking block @@ -59,7 +58,7 @@ TC002.py:17:37: TC002 [*] Move third-party import `pandas.DataFrame` into a type 16 | def f(): 17 | from pandas import DataFrame as df # TC002 | ^^ TC002 -18 | +18 | 19 | x: df | = help: Move into type-checking block @@ -87,7 +86,7 @@ TC002.py:23:22: TC002 [*] Move third-party import `pandas` into a type-checking 22 | def f(): 23 | import pandas as pd # TC002 | ^^ TC002 -24 | +24 | 25 | x: pd.DataFrame = 1 | = help: Move into type-checking block @@ -115,7 +114,7 @@ TC002.py:29:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type 28 | def f(): 29 | from pandas import DataFrame # TC002 | ^^^^^^^^^ TC002 -30 | +30 | 31 | x: DataFrame = 2 | = help: Move into type-checking block @@ -143,7 +142,7 @@ TC002.py:35:37: TC002 [*] Move third-party import `pandas.DataFrame` into a type 34 | def f(): 35 | from pandas import DataFrame as df # TC002 | ^^ TC002 -36 | +36 | 37 | x: df = 3 | = help: Move into type-checking block @@ -171,7 +170,7 @@ TC002.py:41:22: TC002 [*] Move third-party import `pandas` into a type-checking 40 | def f(): 41 | import pandas as pd # TC002 | ^^ TC002 -42 | +42 | 43 | x: "pd.DataFrame" = 1 | = help: Move into type-checking block @@ -199,7 +198,7 @@ TC002.py:47:22: TC002 [*] Move third-party import `pandas` into a type-checking 46 | def f(): 47 | import pandas as pd # TC002 | ^^ TC002 -48 | +48 | 49 | x = dict["pd.DataFrame", "pd.DataFrame"] | = help: Move into type-checking block @@ -225,10 +224,10 @@ TC002.py:47:22: TC002 [*] Move third-party import `pandas` into a type-checking TC002.py:172:24: TC002 [*] Move third-party import `module.Member` into a type-checking block | 170 | global Member -171 | +171 | 172 | from module import Member | ^^^^^^ TC002 -173 | +173 | 174 | x: Member = 1 | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap index f8634941ee..d52dd420f8 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- runtime_evaluated_base_classes_2.py:3:21: TC002 [*] Move third-party import `geopandas` into a type-checking block | 1 | from __future__ import annotations -2 | +2 | 3 | import geopandas as gpd # TC002 | ^^^ TC002 4 | import pydantic diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap index b78f6b4673..daf471f921 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- runtime_evaluated_decorators_2.py:10:8: TC002 [*] Move third-party import `numpy` into a type-checking block | 8 | from attrs import frozen - 9 | + 9 | 10 | import numpy # TC002 | ^^^^^ TC002 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap index 157d972cd3..c226a6cfd1 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- singledispatch.py:12:20: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -8,7 +7,7 @@ singledispatch.py:12:20: TC002 [*] Move third-party import `pandas.DataFrame` in 11 | from scipy.sparse import spmatrix 12 | from pandas import DataFrame | ^^^^^^^^^ TC002 -13 | +13 | 14 | if TYPE_CHECKING: | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap index d1cd9de599..94b85230ae 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- strict.py:54:25: TC002 [*] Move third-party import `pkg.bar.A` into a type-checking block | @@ -8,7 +7,7 @@ strict.py:54:25: TC002 [*] Move third-party import `pkg.bar.A` into a type-check 53 | import pkg 54 | from pkg.bar import A | ^ TC002 -55 | +55 | 56 | def test(value: A): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap index 76f2c216a2..d02dab7f4a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- typing_modules_1.py:7:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | def func(): 7 | from pandas import DataFrame | ^^^^^^^^^ TC002 -8 | +8 | 9 | df: DataFrame | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap index c9f5129aa8..ba8a621fcc 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- typing_modules_2.py:7:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | def func(): 7 | from pandas import DataFrame | ^^^^^^^^^ TC002 -8 | +8 | 9 | df: DataFrame | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap index 1179b87df9..4c00f74102 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :4:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations -3 | +3 | 4 | import pandas as pd | ^^ TC002 -5 | +5 | 6 | from typing import TYPE_CHECKING | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap index 38771b04fb..d5353c0939 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :4:18: TC002 Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations -3 | +3 | 4 | import pandas as pd | ^^ TC002 -5 | +5 | 6 | def f(x: pd.DataFrame): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap index c080a0659e..581f1bb10f 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text --- :6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING -5 | +5 | 6 | import pandas as pd | ^^ TC002 -7 | +7 | 8 | def f(x: pd.DataFrame): | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__unquoted-type-alias_TC007.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__unquoted-type-alias_TC007.py.snap index ddc70534e7..5ce4bcc79f 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__unquoted-type-alias_TC007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__unquoted-type-alias_TC007.py.snap @@ -175,7 +175,7 @@ TC007.py:22:5: TC007 [*] Add quotes to type alias 21 | i: TypeAlias = (Foo | # TC007 x2 (fix removes comment currently) 22 | Bar) | ^^^ TC007 -23 | +23 | 24 | type C = Foo # OK | = help: Add quotes diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap index b1b8ae68ff..0bd147a3e9 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs -snapshot_kind: text --- ARG.py:37:17: ARG002 Unused method argument: `x` | @@ -14,7 +13,7 @@ ARG.py:37:17: ARG002 Unused method argument: `x` ARG.py:40:20: ARG002 Unused method argument: `x` | 38 | print("Hello, world!") -39 | +39 | 40 | def f(self, /, x): | ^ ARG002 41 | print("Hello, world!") @@ -23,7 +22,7 @@ ARG.py:40:20: ARG002 Unused method argument: `x` ARG.py:43:16: ARG002 Unused method argument: `x` | 41 | print("Hello, world!") -42 | +42 | 43 | def f(cls, x): | ^ ARG002 44 | print("Hello, world!") @@ -32,7 +31,7 @@ ARG.py:43:16: ARG002 Unused method argument: `x` ARG.py:58:17: ARG002 Unused method argument: `x` | 56 | print("Hello, world!") -57 | +57 | 58 | def f(self, x): | ^ ARG002 59 | msg[0] = "..." @@ -42,7 +41,7 @@ ARG.py:58:17: ARG002 Unused method argument: `x` ARG.py:62:17: ARG002 Unused method argument: `x` | 60 | raise NotImplementedError(msg) -61 | +61 | 62 | def f(self, x): | ^ ARG002 63 | msg = "..." @@ -52,7 +51,7 @@ ARG.py:62:17: ARG002 Unused method argument: `x` ARG.py:66:17: ARG002 Unused method argument: `x` | 64 | raise NotImplementedError(foo) -65 | +65 | 66 | def f(self, x): | ^ ARG002 67 | msg = "..." diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap index 3f54ce449f..db2dbbab78 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG005_ARG.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs -snapshot_kind: text --- ARG.py:28:8: ARG005 Unused lambda argument: `x` | @@ -8,6 +7,6 @@ ARG.py:28:8: ARG005 Unused lambda argument: `x` 27 | ### 28 | lambda x: print("Hello, world!") | ^ ARG005 -29 | +29 | 30 | lambda: print("Hello, world!") | diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap index 21ec1b0eb1..430bd44bb2 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__enforce_variadic_names.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs -snapshot_kind: text --- ignore_variadic_names.py:1:7: ARG001 Unused function argument: `a` | @@ -63,7 +62,7 @@ ignore_variadic_names.py:10:20: ARG002 Unused method argument: `b` ignore_variadic_names.py:13:17: ARG002 Unused method argument: `a` | 11 | print("Hello, world!") -12 | +12 | 13 | def f(self, a, b, *args, **kwargs): | ^ ARG002 14 | print("Hello, world!") @@ -72,7 +71,7 @@ ignore_variadic_names.py:13:17: ARG002 Unused method argument: `a` ignore_variadic_names.py:13:20: ARG002 Unused method argument: `b` | 11 | print("Hello, world!") -12 | +12 | 13 | def f(self, a, b, *args, **kwargs): | ^ ARG002 14 | print("Hello, world!") @@ -81,7 +80,7 @@ ignore_variadic_names.py:13:20: ARG002 Unused method argument: `b` ignore_variadic_names.py:13:24: ARG002 Unused method argument: `args` | 11 | print("Hello, world!") -12 | +12 | 13 | def f(self, a, b, *args, **kwargs): | ^^^^ ARG002 14 | print("Hello, world!") @@ -90,7 +89,7 @@ ignore_variadic_names.py:13:24: ARG002 Unused method argument: `args` ignore_variadic_names.py:13:32: ARG002 Unused method argument: `kwargs` | 11 | print("Hello, world!") -12 | +12 | 13 | def f(self, a, b, *args, **kwargs): | ^^^^^^ ARG002 14 | print("Hello, world!") diff --git a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap index 3702d0d849..16e2230d2c 100644 --- a/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap +++ b/crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ignore_variadic_names.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_unused_arguments/mod.rs -snapshot_kind: text --- ignore_variadic_names.py:1:7: ARG001 Unused function argument: `a` | @@ -49,7 +48,7 @@ ignore_variadic_names.py:10:20: ARG002 Unused method argument: `b` ignore_variadic_names.py:13:17: ARG002 Unused method argument: `a` | 11 | print("Hello, world!") -12 | +12 | 13 | def f(self, a, b, *args, **kwargs): | ^ ARG002 14 | print("Hello, world!") @@ -58,7 +57,7 @@ ignore_variadic_names.py:13:17: ARG002 Unused method argument: `a` ignore_variadic_names.py:13:20: ARG002 Unused method argument: `b` | 11 | print("Hello, world!") -12 | +12 | 13 | def f(self, a, b, *args, **kwargs): | ^ ARG002 14 | print("Hello, world!") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap index 6a27ee2653..bea8d4778a 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_1.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- py_path_1.py:3:5: PTH124 `py.path` is in maintenance mode, use `pathlib` instead | 1 | import py -2 | +2 | 3 | p = py.path.local("../foo") | ^^^^^^^^^^^^^ PTH124 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap index fcc8f00471..f5b5e5c089 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH124_py_path_2.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- py_path_2.py:3:5: PTH124 `py.path` is in maintenance mode, use `pathlib` instead | 1 | from py.path import local as path -2 | +2 | 3 | p = path("/foo") | ^^^^ PTH124 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap index 51311bf399..4f2fd0ce76 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH202_PTH202.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH202.py:6:1: PTH202 `os.path.getsize` should be replaced by `Path.stat().st_size` | @@ -34,14 +33,14 @@ PTH202.py:9:1: PTH202 `os.path.getsize` should be replaced by `Path.stat().st_si 8 | os.path.getsize(Path("filename")) 9 | os.path.getsize(__file__) | ^^^^^^^^^^^^^^^ PTH202 -10 | +10 | 11 | getsize("filename") | PTH202.py:11:1: PTH202 `os.path.getsize` should be replaced by `Path.stat().st_size` | 9 | os.path.getsize(__file__) -10 | +10 | 11 | getsize("filename") | ^^^^^^^ PTH202 12 | getsize(b"filename") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap index 9e3f3de473..8851d9d32a 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH203_PTH203.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH203.py:5:1: PTH203 `os.path.getatime` should be replaced by `Path.stat().st_atime` | 3 | from os.path import getatime -4 | +4 | 5 | os.path.getatime("filename") | ^^^^^^^^^^^^^^^^ PTH203 6 | os.path.getatime(b"filename") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap index bfa2aefd0e..3edeac694e 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH205_PTH205.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH205.py:6:1: PTH205 `os.path.getctime` should be replaced by `Path.stat().st_ctime` | @@ -24,14 +23,14 @@ PTH205.py:8:1: PTH205 `os.path.getctime` should be replaced by `Path.stat().st_c 7 | os.path.getctime(b"filename") 8 | os.path.getctime(Path("filename")) | ^^^^^^^^^^^^^^^^ PTH205 - 9 | + 9 | 10 | getctime("filename") | PTH205.py:10:1: PTH205 `os.path.getctime` should be replaced by `Path.stat().st_ctime` | 8 | os.path.getctime(Path("filename")) - 9 | + 9 | 10 | getctime("filename") | ^^^^^^^^ PTH205 11 | getctime(b"filename") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap index 0fc3af2ead..70e6338726 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH206_PTH206.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH206.py:8:12: PTH206 Replace `.split(os.sep)` with `Path.parts` | @@ -96,6 +95,6 @@ PTH206.py:17:30: PTH206 Replace `.split(os.sep)` with `Path.parts` 16 | file_name.split(os.sep) 17 | (os.path.abspath(file_name)).split(os.sep) | ^^^^^ PTH206 -18 | +18 | 19 | # OK | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH208_PTH208.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH208_PTH208.py.snap index 27d5009df0..f8dfff97ec 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH208_PTH208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH208_PTH208.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH208.py:3:1: PTH208 Use `pathlib.Path.iterdir()` instead. | 1 | import os -2 | +2 | 3 | os.listdir('.') | ^^^^^^^^^^ PTH208 4 | os.listdir(b'.') @@ -16,7 +15,7 @@ PTH208.py:4:1: PTH208 Use `pathlib.Path.iterdir()` instead. 3 | os.listdir('.') 4 | os.listdir(b'.') | ^^^^^^^^^^ PTH208 -5 | +5 | 6 | string_path = '.' | @@ -25,7 +24,7 @@ PTH208.py:7:1: PTH208 Use `pathlib.Path.iterdir()` instead. 6 | string_path = '.' 7 | os.listdir(string_path) | ^^^^^^^^^^ PTH208 -8 | +8 | 9 | bytes_path = b'.' | @@ -53,7 +52,7 @@ PTH208.py:19:4: PTH208 Use `pathlib.Path.iterdir()` instead. PTH208.py:22:14: PTH208 Use `pathlib.Path.iterdir()` instead. | 20 | ... -21 | +21 | 22 | if "file" in os.listdir("dir"): | ^^^^^^^^^^ PTH208 23 | ... diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210.py.snap index 289e4fbef6..157a100789 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH210.py:21:1: PTH210 Invalid suffix passed to `.with_suffix()` | @@ -80,7 +79,7 @@ PTH210.py:25:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` 24 | path.with_suffix(u'' "json") 25 | path.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -26 | +26 | 27 | posix_path.with_suffix(".") | = help: Add a leading dot @@ -98,7 +97,7 @@ PTH210.py:25:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` PTH210.py:27:1: PTH210 Invalid suffix passed to `.with_suffix()` | 25 | path.with_suffix(suffix="js") -26 | +26 | 27 | posix_path.with_suffix(".") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 28 | posix_path.with_suffix("py") @@ -173,7 +172,7 @@ PTH210.py:31:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` 30 | posix_path.with_suffix(u'' "json") 31 | posix_path.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -32 | +32 | 33 | pure_path.with_suffix(".") | = help: Add a leading dot @@ -191,7 +190,7 @@ PTH210.py:31:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` PTH210.py:33:1: PTH210 Invalid suffix passed to `.with_suffix()` | 31 | posix_path.with_suffix(suffix="js") -32 | +32 | 33 | pure_path.with_suffix(".") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 34 | pure_path.with_suffix("py") @@ -266,7 +265,7 @@ PTH210.py:37:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` 36 | pure_path.with_suffix(u'' "json") 37 | pure_path.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -38 | +38 | 39 | pure_posix_path.with_suffix(".") | = help: Add a leading dot @@ -284,7 +283,7 @@ PTH210.py:37:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` PTH210.py:39:1: PTH210 Invalid suffix passed to `.with_suffix()` | 37 | pure_path.with_suffix(suffix="js") -38 | +38 | 39 | pure_posix_path.with_suffix(".") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 40 | pure_posix_path.with_suffix("py") @@ -359,7 +358,7 @@ PTH210.py:43:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` 42 | pure_posix_path.with_suffix(u'' "json") 43 | pure_posix_path.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -44 | +44 | 45 | pure_windows_path.with_suffix(".") | = help: Add a leading dot @@ -377,7 +376,7 @@ PTH210.py:43:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` PTH210.py:45:1: PTH210 Invalid suffix passed to `.with_suffix()` | 43 | pure_posix_path.with_suffix(suffix="js") -44 | +44 | 45 | pure_windows_path.with_suffix(".") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 46 | pure_windows_path.with_suffix("py") @@ -452,7 +451,7 @@ PTH210.py:49:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` 48 | pure_windows_path.with_suffix(u'' "json") 49 | pure_windows_path.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -50 | +50 | 51 | windows_path.with_suffix(".") | = help: Add a leading dot @@ -470,7 +469,7 @@ PTH210.py:49:1: PTH210 [*] Dotless suffix passed to `.with_suffix()` PTH210.py:51:1: PTH210 Invalid suffix passed to `.with_suffix()` | 49 | pure_windows_path.with_suffix(suffix="js") -50 | +50 | 51 | windows_path.with_suffix(".") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 52 | windows_path.with_suffix("py") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210_1.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210_1.py.snap index e394e5341f..9778ac85a9 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH210_PTH210_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- PTH210_1.py:13:5: PTH210 Invalid suffix passed to `.with_suffix()` | @@ -81,7 +80,7 @@ PTH210_1.py:17:5: PTH210 [*] Dotless suffix passed to `.with_suffix()` 16 | p.with_suffix(u'' "json") 17 | p.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -18 | +18 | 19 | ## No errors | = help: Add a leading dot @@ -175,7 +174,7 @@ PTH210_1.py:35:5: PTH210 [*] Dotless suffix passed to `.with_suffix()` 34 | p.with_suffix(u'' "json") 35 | p.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -36 | +36 | 37 | ## No errors | = help: Add a leading dot @@ -269,7 +268,7 @@ PTH210_1.py:53:5: PTH210 [*] Dotless suffix passed to `.with_suffix()` 52 | p.with_suffix(u'' "json") 53 | p.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -54 | +54 | 55 | ## No errors | = help: Add a leading dot @@ -363,7 +362,7 @@ PTH210_1.py:71:5: PTH210 [*] Dotless suffix passed to `.with_suffix()` 70 | p.with_suffix(u'' "json") 71 | p.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -72 | +72 | 73 | ## No errors | = help: Add a leading dot @@ -457,7 +456,7 @@ PTH210_1.py:89:5: PTH210 [*] Dotless suffix passed to `.with_suffix()` 88 | p.with_suffix(u'' "json") 89 | p.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -90 | +90 | 91 | ## No errors | = help: Add a leading dot @@ -551,7 +550,7 @@ PTH210_1.py:107:5: PTH210 [*] Dotless suffix passed to `.with_suffix()` 106 | p.with_suffix(u'' "json") 107 | p.with_suffix(suffix="js") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210 -108 | +108 | 109 | ## No errors | = help: Add a leading dot diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap index 1bc3020743..e0d29b06be 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__full_name.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- full_name.py:7:5: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()` | 5 | q = "bar" -6 | +6 | 7 | a = os.path.abspath(p) | ^^^^^^^^^^^^^^^ PTH100 8 | aa = os.chmod(p) @@ -296,7 +295,7 @@ full_name.py:37:1: PTH118 `os.sep.join()` should be replaced by `Path.joinpath() 36 | os.path.join(p, *q) 37 | os.sep.join(p, *q) | ^^^^^^^^^^^ PTH118 -38 | +38 | 39 | # https://github.com/astral-sh/ruff/issues/7620 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap index ba094e790e..dcf8d8a659 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_as.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- import_as.py:7:5: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()` | 5 | q = "bar" -6 | +6 | 7 | a = foo_p.abspath(p) | ^^^^^^^^^^^^^ PTH100 8 | aa = foo.chmod(p) diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap index 1da01f6ad7..0cacb90179 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs import_from.py:9:5: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()` | 7 | q = "bar" - 8 | + 8 | 9 | a = abspath(p) | ^^^^^^^ PTH100 10 | aa = chmod(p) @@ -271,7 +271,7 @@ import_from.py:36:1: PTH123 `open()` should be replaced by `Path.open()` import_from.py:43:10: PTH123 `open()` should be replaced by `Path.open()` | 41 | from builtins import open -42 | +42 | 43 | with open(p) as _: ... # Error | ^^^^ PTH123 | diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap index 685a57a5c4..7f9fc380f4 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__import_from_as.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs -snapshot_kind: text --- import_from_as.py:14:5: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()` | 12 | q = "bar" -13 | +13 | 14 | a = xabspath(p) | ^^^^^^^^ PTH100 15 | aa = xchmod(p) diff --git a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap index cdc4d6f996..9a1e06585c 100644 --- a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap +++ b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/flynt/mod.rs -snapshot_kind: text --- FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join | @@ -111,7 +110,7 @@ FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_ 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FLY002 -11 | +11 | 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) | = help: Replace with `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap index 19ce312aa3..8197eb32fc 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__leading_prefix.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs -snapshot_kind: text --- leading_prefix.py:1:8: I001 Import block is un-sorted or un-formatted | @@ -8,7 +7,7 @@ leading_prefix.py:1:8: I001 Import block is un-sorted or un-formatted | ________^ 2 | | import os | |_________^ I001 -3 | +3 | 4 | if True: | = help: Organize imports @@ -20,7 +19,7 @@ leading_prefix.py:5:12: I001 Import block is un-sorted or un-formatted | ____________^ 6 | | import os | |_____________^ I001 -7 | +7 | 8 | if True: | = help: Organize imports @@ -31,7 +30,7 @@ leading_prefix.py:10:9: I001 Import block is un-sorted or un-formatted 9 | x = 1; \ 10 | import os | ^^^^^^^^^ I001 -11 | +11 | 12 | x = 1; \ | = help: Organize imports diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap index d2e56b8e36..4701571f2e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/isort/mod.rs -snapshot_kind: text --- unused.py:5:8: F401 [*] `sys` imported but unused | 4 | # Unused, _not_ marked as required. 5 | import sys | ^^^ F401 -6 | +6 | 7 | # Unused, _not_ marked as required (due to the alias). | = help: Remove unused import: `sys` @@ -26,7 +25,7 @@ unused.py:8:19: F401 [*] `pathlib` imported but unused 7 | # Unused, _not_ marked as required (due to the alias). 8 | import pathlib as non_alias | ^^^^^^^^^ F401 - 9 | + 9 | 10 | # Unused, marked as required. | = help: Remove unused import: `pathlib` diff --git a/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap b/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap index 6e8463c24d..5bce1a36f6 100644 --- a/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap +++ b/crates/ruff_linter/src/rules/mccabe/snapshots/ruff_linter__rules__mccabe__tests__max_complexity_0.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/mccabe/mod.rs -snapshot_kind: text --- C901.py:2:5: C901 `trivial` is too complex (1 > 0) | @@ -156,7 +155,7 @@ C901.py:118:17: C901 `a` is too complex (1 > 0) C901.py:121:17: C901 `b` is too complex (2 > 0) | 119 | pass -120 | +120 | 121 | def b(self, data): | ^ C901 122 | if not args: @@ -174,7 +173,7 @@ C901.py:126:17: C901 `c` is too complex (1 > 0) C901.py:129:17: C901 `error` is too complex (1 > 0) | 127 | pass -128 | +128 | 129 | def error(self, message): | ^^^^^ C901 130 | pass @@ -183,7 +182,7 @@ C901.py:129:17: C901 `error` is too complex (1 > 0) C901.py:132:17: C901 `info` is too complex (1 > 0) | 130 | pass -131 | +131 | 132 | def info(self, message): | ^^^^ C901 133 | pass @@ -192,7 +191,7 @@ C901.py:132:17: C901 `info` is too complex (1 > 0) C901.py:135:17: C901 `exception` is too complex (1 > 0) | 133 | pass -134 | +134 | 135 | def exception(self): | ^^^^^^^^^ C901 136 | pass diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap index e7db8cbc60..879eb315a4 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs -snapshot_kind: text --- NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | 2 | import numpy as np -3 | +3 | 4 | np.round_(np.random.rand(5, 5), 2) | ^^^^^^^^^ NPY003 5 | np.product(np.random.rand(5, 5)) @@ -106,7 +105,7 @@ NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | 12 | from numpy import round_, product, cumproduct, sometrue, alltrue -13 | +13 | 14 | round_(np.random.rand(5, 5), 2) | ^^^^^^ NPY003 15 | product(np.random.rand(5, 5)) diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap index be73ca901f..b26f49ebd0 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs -snapshot_kind: text --- NPY001.py:6:1: NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type | @@ -27,7 +26,7 @@ NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builti 6 | npy.float 7 | npy.int | ^^^^^^^ NPY001 -8 | +8 | 9 | if dtype == np.object: | = help: Replace `np.int` with builtin type @@ -45,7 +44,7 @@ NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builti NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type | 7 | npy.int - 8 | + 8 | 9 | if dtype == np.object: | ^^^^^^^^^ NPY001 10 | ... @@ -65,10 +64,10 @@ NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with bu NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 10 | ... -11 | +11 | 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex]) | ^^^^^^ NPY001 -13 | +13 | 14 | pdf = pd.DataFrame( | = help: Replace `np.int` with builtin type @@ -86,10 +85,10 @@ NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with buil NPY001.py:12:80: NPY001 [*] Type alias `np.complex` is deprecated, replace with builtin type | 10 | ... -11 | +11 | 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex]) | ^^^^^^^^^^ NPY001 -13 | +13 | 14 | pdf = pd.DataFrame( | = help: Replace `np.complex` with builtin type @@ -127,10 +126,10 @@ NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with b NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 18 | ) -19 | +19 | 20 | _ = arr.astype(np.int) | ^^^^^^ NPY001 -21 | +21 | 22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952 | = help: Replace `np.int` with builtin type @@ -148,7 +147,7 @@ NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with buil NPY001.py:25:1: NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type | 23 | from numpy import float -24 | +24 | 25 | float(1) | ^^^^^ NPY001 | diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap index 2a33936384..150b3490be 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-legacy-random_NPY002.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs -snapshot_kind: text --- NPY002.py:12:8: NPY002 Replace legacy `np.random.standard_normal` call with `np.random.Generator` | 10 | from numpy import random -11 | +11 | 12 | vals = random.standard_normal(10) | ^^^^^^^^^^^^^^^^^^^^^^ NPY002 13 | more_vals = random.standard_normal(10) @@ -23,7 +22,7 @@ NPY002.py:13:13: NPY002 Replace legacy `np.random.standard_normal` call with `np NPY002.py:18:1: NPY002 Replace legacy `np.random.seed` call with `np.random.Generator` | 16 | import numpy -17 | +17 | 18 | numpy.random.seed() | ^^^^^^^^^^^^^^^^^ NPY002 19 | numpy.random.get_state() diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap index 8c0a6a92e7..124a069953 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs -snapshot_kind: text --- NPY201.py:4:5: NPY201 [*] `np.add_docstring` will be removed in NumPy 2.0. Use `numpy.lib.add_docstring` instead. | 2 | import numpy as np -3 | +3 | 4 | np.add_docstring | ^^^^^^^^^^^^^^^^ NPY201 -5 | +5 | 6 | np.add_newdoc | = help: Replace with `numpy.lib.add_docstring` @@ -27,10 +26,10 @@ NPY201.py:4:5: NPY201 [*] `np.add_docstring` will be removed in NumPy 2.0. Use ` NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `numpy.lib.add_newdoc` instead. | 4 | np.add_docstring -5 | +5 | 6 | np.add_newdoc | ^^^^^^^^^^^^^ NPY201 -7 | +7 | 8 | np.add_newdoc_ufunc | = help: Replace with `numpy.lib.add_newdoc` @@ -51,30 +50,30 @@ NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `num NPY201.py:8:5: NPY201 `np.add_newdoc_ufunc` will be removed in NumPy 2.0. `add_newdoc_ufunc` is an internal function. | 6 | np.add_newdoc - 7 | + 7 | 8 | np.add_newdoc_ufunc | ^^^^^^^^^^^^^^^^^^^ NPY201 - 9 | + 9 | 10 | np.asfarray([1,2,3]) | NPY201.py:10:5: NPY201 `np.asfarray` will be removed in NumPy 2.0. Use `np.asarray` with a `float` dtype instead. | 8 | np.add_newdoc_ufunc - 9 | + 9 | 10 | np.asfarray([1,2,3]) | ^^^^^^^^^^^ NPY201 -11 | +11 | 12 | np.byte_bounds(np.array([1,2,3])) | NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `numpy.lib.array_utils.byte_bounds` on NumPy 2.0, or ignore this warning on earlier versions. | 10 | np.asfarray([1,2,3]) -11 | +11 | 12 | np.byte_bounds(np.array([1,2,3])) | ^^^^^^^^^^^^^^ NPY201 -13 | +13 | 14 | np.cast | = help: Replace with `numpy.lib.array_utils.byte_bounds` (requires NumPy 2.0 or greater) @@ -97,20 +96,20 @@ NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `n NPY201.py:14:5: NPY201 `np.cast` will be removed in NumPy 2.0. Use `np.asarray(arr, dtype=dtype)` instead. | 12 | np.byte_bounds(np.array([1,2,3])) -13 | +13 | 14 | np.cast | ^^^^^^^ NPY201 -15 | +15 | 16 | np.cfloat(12+34j) | NPY201.py:16:5: NPY201 [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy.complex128` instead. | 14 | np.cast -15 | +15 | 16 | np.cfloat(12+34j) | ^^^^^^^^^ NPY201 -17 | +17 | 18 | np.clongfloat(12+34j) | = help: Replace with `numpy.complex128` @@ -128,10 +127,10 @@ NPY201.py:16:5: NPY201 [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy. NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. | 16 | np.cfloat(12+34j) -17 | +17 | 18 | np.clongfloat(12+34j) | ^^^^^^^^^^^^^ NPY201 -19 | +19 | 20 | np.compat | = help: Replace with `numpy.clongdouble` @@ -149,20 +148,20 @@ NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `nu NPY201.py:20:5: NPY201 `np.compat` will be removed in NumPy 2.0. Python 2 is no longer supported. | 18 | np.clongfloat(12+34j) -19 | +19 | 20 | np.compat | ^^^^^^^^^ NPY201 -21 | +21 | 22 | np.complex_(12+34j) | NPY201.py:22:5: NPY201 [*] `np.complex_` will be removed in NumPy 2.0. Use `numpy.complex128` instead. | 20 | np.compat -21 | +21 | 22 | np.complex_(12+34j) | ^^^^^^^^^^^ NPY201 -23 | +23 | 24 | np.DataSource | = help: Replace with `numpy.complex128` @@ -180,10 +179,10 @@ NPY201.py:22:5: NPY201 [*] `np.complex_` will be removed in NumPy 2.0. Use `nump NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `numpy.lib.npyio.DataSource` instead. | 22 | np.complex_(12+34j) -23 | +23 | 24 | np.DataSource | ^^^^^^^^^^^^^ NPY201 -25 | +25 | 26 | np.deprecate | = help: Replace with `numpy.lib.npyio.DataSource` @@ -206,70 +205,70 @@ NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `nu NPY201.py:26:5: NPY201 `np.deprecate` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. | 24 | np.DataSource -25 | +25 | 26 | np.deprecate | ^^^^^^^^^^^^ NPY201 -27 | +27 | 28 | np.deprecate_with_doc | NPY201.py:28:5: NPY201 `np.deprecate_with_doc` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. | 26 | np.deprecate -27 | +27 | 28 | np.deprecate_with_doc | ^^^^^^^^^^^^^^^^^^^^^ NPY201 -29 | +29 | 30 | np.disp(10) | NPY201.py:30:5: NPY201 `np.disp` will be removed in NumPy 2.0. Use a dedicated print function instead. | 28 | np.deprecate_with_doc -29 | +29 | 30 | np.disp(10) | ^^^^^^^ NPY201 -31 | +31 | 32 | np.fastCopyAndTranspose | NPY201.py:32:5: NPY201 `np.fastCopyAndTranspose` will be removed in NumPy 2.0. Use `arr.T.copy()` instead. | 30 | np.disp(10) -31 | +31 | 32 | np.fastCopyAndTranspose | ^^^^^^^^^^^^^^^^^^^^^^^ NPY201 -33 | +33 | 34 | np.find_common_type | NPY201.py:34:5: NPY201 `np.find_common_type` will be removed in NumPy 2.0. Use `numpy.promote_types` or `numpy.result_type` instead. To achieve semantics for the `scalar_types` argument, use `numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`. | 32 | np.fastCopyAndTranspose -33 | +33 | 34 | np.find_common_type | ^^^^^^^^^^^^^^^^^^^ NPY201 -35 | +35 | 36 | np.get_array_wrap | NPY201.py:36:5: NPY201 `np.get_array_wrap` will be removed without replacement in NumPy 2.0 | 34 | np.find_common_type -35 | +35 | 36 | np.get_array_wrap | ^^^^^^^^^^^^^^^^^ NPY201 -37 | +37 | 38 | np.float_ | NPY201.py:38:5: NPY201 [*] `np.float_` will be removed in NumPy 2.0. Use `numpy.float64` instead. | 36 | np.get_array_wrap -37 | +37 | 38 | np.float_ | ^^^^^^^^^ NPY201 -39 | +39 | 40 | np.geterrobj | = help: Replace with `numpy.float64` @@ -287,20 +286,20 @@ NPY201.py:38:5: NPY201 [*] `np.float_` will be removed in NumPy 2.0. Use `numpy. NPY201.py:40:5: NPY201 `np.geterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. | 38 | np.float_ -39 | +39 | 40 | np.geterrobj | ^^^^^^^^^^^^ NPY201 -41 | +41 | 42 | np.Inf | NPY201.py:42:5: NPY201 [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf` instead. | 40 | np.geterrobj -41 | +41 | 42 | np.Inf | ^^^^^^ NPY201 -43 | +43 | 44 | np.Infinity | = help: Replace with `numpy.inf` @@ -318,10 +317,10 @@ NPY201.py:42:5: NPY201 [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `numpy.inf` instead. | 42 | np.Inf -43 | +43 | 44 | np.Infinity | ^^^^^^^^^^^ NPY201 -45 | +45 | 46 | np.infty | = help: Replace with `numpy.inf` @@ -339,10 +338,10 @@ NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `nump NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.inf` instead. | 44 | np.Infinity -45 | +45 | 46 | np.infty | ^^^^^^^^ NPY201 -47 | +47 | 48 | np.issctype | = help: Replace with `numpy.inf` @@ -360,20 +359,20 @@ NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.i NPY201.py:48:5: NPY201 `np.issctype` will be removed without replacement in NumPy 2.0 | 46 | np.infty -47 | +47 | 48 | np.issctype | ^^^^^^^^^^^ NPY201 -49 | +49 | 50 | np.issubclass_(np.int32, np.integer) | NPY201.py:50:5: NPY201 [*] `np.issubclass_` will be removed in NumPy 2.0. Use `issubclass` instead. | 48 | np.issctype -49 | +49 | 50 | np.issubclass_(np.int32, np.integer) | ^^^^^^^^^^^^^^ NPY201 -51 | +51 | 52 | np.issubsctype | = help: Replace with `issubclass` @@ -391,10 +390,10 @@ NPY201.py:50:5: NPY201 [*] `np.issubclass_` will be removed in NumPy 2.0. Use `i NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `numpy.issubdtype` instead. | 50 | np.issubclass_(np.int32, np.integer) -51 | +51 | 52 | np.issubsctype | ^^^^^^^^^^^^^^ NPY201 -53 | +53 | 54 | np.mat | = help: Replace with `numpy.issubdtype` @@ -412,10 +411,10 @@ NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `n NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asmatrix` instead. | 52 | np.issubsctype -53 | +53 | 54 | np.mat | ^^^^^^ NPY201 -55 | +55 | 56 | np.maximum_sctype | = help: Replace with `numpy.asmatrix` @@ -433,20 +432,20 @@ NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asm NPY201.py:56:5: NPY201 `np.maximum_sctype` will be removed without replacement in NumPy 2.0 | 54 | np.mat -55 | +55 | 56 | np.maximum_sctype | ^^^^^^^^^^^^^^^^^ NPY201 -57 | +57 | 58 | np.NaN | NPY201.py:58:5: NPY201 [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan` instead. | 56 | np.maximum_sctype -57 | +57 | 58 | np.NaN | ^^^^^^ NPY201 -59 | +59 | 60 | np.nbytes[np.int64] | = help: Replace with `numpy.nan` @@ -464,20 +463,20 @@ NPY201.py:58:5: NPY201 [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan NPY201.py:60:5: NPY201 `np.nbytes` will be removed in NumPy 2.0. Use `np.dtype().itemsize` instead. | 58 | np.NaN -59 | +59 | 60 | np.nbytes[np.int64] | ^^^^^^^^^ NPY201 -61 | +61 | 62 | np.NINF | NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` instead. | 60 | np.nbytes[np.int64] -61 | +61 | 62 | np.NINF | ^^^^^^^ NPY201 -63 | +63 | 64 | np.NZERO | = help: Replace with `-np.inf` @@ -495,10 +494,10 @@ NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` instead. | 62 | np.NINF -63 | +63 | 64 | np.NZERO | ^^^^^^^^ NPY201 -65 | +65 | 66 | np.longcomplex(12+34j) | = help: Replace with `-0.0` @@ -516,10 +515,10 @@ NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` i NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. | 64 | np.NZERO -65 | +65 | 66 | np.longcomplex(12+34j) | ^^^^^^^^^^^^^^ NPY201 -67 | +67 | 68 | np.longfloat(12+34j) | = help: Replace with `numpy.clongdouble` @@ -537,10 +536,10 @@ NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `n NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `numpy.longdouble` instead. | 66 | np.longcomplex(12+34j) -67 | +67 | 68 | np.longfloat(12+34j) | ^^^^^^^^^^^^ NPY201 -69 | +69 | 70 | np.lookfor | = help: Replace with `numpy.longdouble` @@ -558,20 +557,20 @@ NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `num NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly. | 68 | np.longfloat(12+34j) -69 | +69 | 70 | np.lookfor | ^^^^^^^^^^ NPY201 -71 | +71 | 72 | np.NAN | NPY201.py:72:5: NPY201 [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan` instead. | 70 | np.lookfor -71 | +71 | 72 | np.NAN | ^^^^^^ NPY201 -73 | +73 | 74 | try: | = help: Replace with `numpy.nan` diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap index bf39ffc353..9350fd8d19 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap @@ -1,24 +1,23 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs -snapshot_kind: text --- NPY201_2.py:4:5: NPY201 `np.obj2sctype` will be removed without replacement in NumPy 2.0 | 2 | import numpy as np -3 | +3 | 4 | np.obj2sctype(int) | ^^^^^^^^^^^^^ NPY201 -5 | +5 | 6 | np.PINF | NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.inf` instead. | 4 | np.obj2sctype(int) -5 | +5 | 6 | np.PINF | ^^^^^^^ NPY201 -7 | +7 | 8 | np.PZERO | = help: Replace with `numpy.inf` @@ -36,10 +35,10 @@ NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.i NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` instead. | 6 | np.PINF - 7 | + 7 | 8 | np.PZERO | ^^^^^^^^ NPY201 - 9 | + 9 | 10 | np.recfromcsv | = help: Replace with `0.0` @@ -57,30 +56,30 @@ NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` i NPY201_2.py:10:5: NPY201 `np.recfromcsv` will be removed in NumPy 2.0. Use `np.genfromtxt` with comma delimiter instead. | 8 | np.PZERO - 9 | + 9 | 10 | np.recfromcsv | ^^^^^^^^^^^^^ NPY201 -11 | +11 | 12 | np.recfromtxt | NPY201_2.py:12:5: NPY201 `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead. | 10 | np.recfromcsv -11 | +11 | 12 | np.recfromtxt | ^^^^^^^^^^^^^ NPY201 -13 | +13 | 14 | np.round_(12.34) | NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `numpy.round` instead. | 12 | np.recfromtxt -13 | +13 | 14 | np.round_(12.34) | ^^^^^^^^^ NPY201 -15 | +15 | 16 | np.safe_eval | = help: Replace with `numpy.round` @@ -98,10 +97,10 @@ NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `nump NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `ast.literal_eval` instead. | 14 | np.round_(12.34) -15 | +15 | 16 | np.safe_eval | ^^^^^^^^^^^^ NPY201 -17 | +17 | 18 | np.sctype2char | = help: Replace with `ast.literal_eval` @@ -124,50 +123,50 @@ NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `a NPY201_2.py:18:5: NPY201 `np.sctype2char` will be removed without replacement in NumPy 2.0 | 16 | np.safe_eval -17 | +17 | 18 | np.sctype2char | ^^^^^^^^^^^^^^ NPY201 -19 | +19 | 20 | np.sctypes | NPY201_2.py:20:5: NPY201 `np.sctypes` will be removed without replacement in NumPy 2.0 | 18 | np.sctype2char -19 | +19 | 20 | np.sctypes | ^^^^^^^^^^ NPY201 -21 | +21 | 22 | np.seterrobj | NPY201_2.py:22:5: NPY201 `np.seterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. | 20 | np.sctypes -21 | +21 | 22 | np.seterrobj | ^^^^^^^^^^^^ NPY201 -23 | +23 | 24 | np.set_numeric_ops | NPY201_2.py:26:5: NPY201 `np.set_string_function` will be removed in NumPy 2.0. Use `np.set_printoptions` for custom printing of NumPy objects. | 24 | np.set_numeric_ops -25 | +25 | 26 | np.set_string_function | ^^^^^^^^^^^^^^^^^^^^^^ NPY201 -27 | +27 | 28 | np.singlecomplex(12+1j) | NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Use `numpy.complex64` instead. | 26 | np.set_string_function -27 | +27 | 28 | np.singlecomplex(12+1j) | ^^^^^^^^^^^^^^^^ NPY201 -29 | +29 | 30 | np.string_("asdf") | = help: Replace with `numpy.complex64` @@ -185,10 +184,10 @@ NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Us NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead. | 28 | np.singlecomplex(12+1j) -29 | +29 | 30 | np.string_("asdf") | ^^^^^^^^^^ NPY201 -31 | +31 | 32 | np.source | = help: Replace with `numpy.bytes_` @@ -206,10 +205,10 @@ NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `num NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `inspect.getsource` instead. | 30 | np.string_("asdf") -31 | +31 | 32 | np.source | ^^^^^^^^^ NPY201 -33 | +33 | 34 | np.tracemalloc_domain | = help: Replace with `inspect.getsource` @@ -232,10 +231,10 @@ NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `insp NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2.0. Use `numpy.lib.tracemalloc_domain` instead. | 32 | np.source -33 | +33 | 34 | np.tracemalloc_domain | ^^^^^^^^^^^^^^^^^^^^^ NPY201 -35 | +35 | 36 | np.unicode_("asf") | = help: Replace with `numpy.lib.tracemalloc_domain` @@ -258,10 +257,10 @@ NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2. NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `numpy.str_` instead. | 34 | np.tracemalloc_domain -35 | +35 | 36 | np.unicode_("asf") | ^^^^^^^^^^^ NPY201 -37 | +37 | 38 | np.who() | = help: Replace with `numpy.str_` @@ -279,20 +278,20 @@ NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `nu NPY201_2.py:38:5: NPY201 `np.who` will be removed in NumPy 2.0. Use an IDE variable explorer or `locals()` instead. | 36 | np.unicode_("asf") -37 | +37 | 38 | np.who() | ^^^^^^ NPY201 -39 | +39 | 40 | np.row_stack(([1,2], [3,4])) | NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `numpy.vstack` instead. | 38 | np.who() -39 | +39 | 40 | np.row_stack(([1,2], [3,4])) | ^^^^^^^^^^^^ NPY201 -41 | +41 | 42 | np.alltrue([True, True]) | = help: Replace with `numpy.vstack` @@ -310,10 +309,10 @@ NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `n NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. | 40 | np.row_stack(([1,2], [3,4])) -41 | +41 | 42 | np.alltrue([True, True]) | ^^^^^^^^^^ NPY201 -43 | +43 | 44 | np.sometrue([True, False]) | = help: Replace with `numpy.all` @@ -331,10 +330,10 @@ NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. | 42 | np.alltrue([True, True]) -43 | +43 | 44 | np.sometrue([True, False]) | ^^^^^^^^^^^ NPY201 -45 | +45 | 46 | np.cumproduct([1, 2, 3]) | = help: Replace with `numpy.any` @@ -352,10 +351,10 @@ NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use `numpy.cumprod` instead. | 44 | np.sometrue([True, False]) -45 | +45 | 46 | np.cumproduct([1, 2, 3]) | ^^^^^^^^^^^^^ NPY201 -47 | +47 | 48 | np.product([1, 2, 3]) | = help: Replace with `numpy.cumprod` @@ -373,10 +372,10 @@ NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use ` NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `numpy.prod` instead. | 46 | np.cumproduct([1, 2, 3]) -47 | +47 | 48 | np.product([1, 2, 3]) | ^^^^^^^^^^ NPY201 -49 | +49 | 50 | np.trapz([1, 2, 3]) | = help: Replace with `numpy.prod` @@ -394,10 +393,10 @@ NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `num NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions. | 48 | np.product([1, 2, 3]) -49 | +49 | 50 | np.trapz([1, 2, 3]) | ^^^^^^^^ NPY201 -51 | +51 | 52 | np.in1d([1, 2], [1, 3, 5]) | = help: Replace with `numpy.trapezoid` (requires NumPy 2.0 or greater) @@ -415,10 +414,10 @@ NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy.isin` instead. | 50 | np.trapz([1, 2, 3]) -51 | +51 | 52 | np.in1d([1, 2], [1, 3, 5]) | ^^^^^^^ NPY201 -53 | +53 | 54 | np.AxisError | = help: Replace with `numpy.isin` @@ -436,10 +435,10 @@ NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy. NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `numpy.exceptions.AxisError` instead. | 52 | np.in1d([1, 2], [1, 3, 5]) -53 | +53 | 54 | np.AxisError | ^^^^^^^^^^^^ NPY201 -55 | +55 | 56 | np.ComplexWarning | = help: Replace with `numpy.exceptions.AxisError` @@ -462,10 +461,10 @@ NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `n NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ComplexWarning` instead. | 54 | np.AxisError -55 | +55 | 56 | np.ComplexWarning | ^^^^^^^^^^^^^^^^^ NPY201 -57 | +57 | 58 | np.compare_chararrays | = help: Replace with `numpy.exceptions.ComplexWarning` @@ -488,10 +487,10 @@ NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. U NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2.0. Use `numpy.char.compare_chararrays` instead. | 56 | np.ComplexWarning -57 | +57 | 58 | np.compare_chararrays | ^^^^^^^^^^^^^^^^^^^^^ NPY201 -59 | +59 | 60 | try: | = help: Replace with `numpy.char.compare_chararrays` @@ -517,7 +516,7 @@ NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 62 | except TypeError: 63 | np.alltrue([True, True]) # Should emit a warning here (`except TypeError`, not `except AttributeError`) | ^^^^^^^^^^ NPY201 -64 | +64 | 65 | try: | = help: Replace with `numpy.all` diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap index 57e91dfff4..bcdea9554d 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs -snapshot_kind: text --- NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2.0. Use `numpy.exceptions.DTypePromotionError` instead. | 2 | import numpy as np -3 | +3 | 4 | np.DTypePromotionError | ^^^^^^^^^^^^^^^^^^^^^^ NPY201 -5 | +5 | 6 | np.ModuleDeprecationWarning | = help: Replace with `numpy.exceptions.DTypePromotionError` @@ -27,10 +26,10 @@ NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2. NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ModuleDeprecationWarning` instead. | 4 | np.DTypePromotionError -5 | +5 | 6 | np.ModuleDeprecationWarning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ NPY201 -7 | +7 | 8 | np.RankWarning | = help: Replace with `numpy.exceptions.ModuleDeprecationWarning` @@ -51,10 +50,10 @@ NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in Num NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.RankWarning` on NumPy 2.0, or ignore this warning on earlier versions. | 6 | np.ModuleDeprecationWarning - 7 | + 7 | 8 | np.RankWarning | ^^^^^^^^^^^^^^ NPY201 - 9 | + 9 | 10 | np.TooHardError | = help: Replace with `numpy.exceptions.RankWarning` (requires NumPy 2.0 or greater) @@ -77,10 +76,10 @@ NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use ` NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use `numpy.exceptions.TooHardError` instead. | 8 | np.RankWarning - 9 | + 9 | 10 | np.TooHardError | ^^^^^^^^^^^^^^^ NPY201 -11 | +11 | 12 | np.VisibleDeprecationWarning | = help: Replace with `numpy.exceptions.TooHardError` @@ -103,10 +102,10 @@ NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.VisibleDeprecationWarning` instead. | 10 | np.TooHardError -11 | +11 | 12 | np.VisibleDeprecationWarning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NPY201 -13 | +13 | 14 | np.chararray | = help: Replace with `numpy.exceptions.VisibleDeprecationWarning` @@ -129,10 +128,10 @@ NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in N NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `numpy.char.chararray` instead. | 12 | np.VisibleDeprecationWarning -13 | +13 | 14 | np.chararray | ^^^^^^^^^^^^ NPY201 -15 | +15 | 16 | np.format_parser | = help: Replace with `numpy.char.chararray` @@ -154,7 +153,7 @@ NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `n NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Use `numpy.rec.format_parser` instead. | 14 | np.chararray -15 | +15 | 16 | np.format_parser | ^^^^^^^^^^^^^^^^ NPY201 | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap index b1bc23c5d7..1d9c8f3df5 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs -snapshot_kind: text --- PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 3 | x = pd.DataFrame() -4 | +4 | 5 | x.drop(["a"], axis=1, inplace=True) | ^^^^^^^^^^^^ PD002 -6 | +6 | 7 | x.y.drop(["a"], axis=1, inplace=True) | = help: Assign to variable; remove `inplace` arg @@ -26,10 +25,10 @@ PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent b PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 5 | x.drop(["a"], axis=1, inplace=True) -6 | +6 | 7 | x.y.drop(["a"], axis=1, inplace=True) | ^^^^^^^^^^^^ PD002 -8 | +8 | 9 | x["y"].drop(["a"], axis=1, inplace=True) | = help: Assign to variable; remove `inplace` arg @@ -47,10 +46,10 @@ PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent b PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 7 | x.y.drop(["a"], axis=1, inplace=True) - 8 | + 8 | 9 | x["y"].drop(["a"], axis=1, inplace=True) | ^^^^^^^^^^^^ PD002 -10 | +10 | 11 | x.drop( | = help: Assign to variable; remove `inplace` arg @@ -111,7 +110,7 @@ PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent b PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 22 | ) -23 | +23 | 24 | x.drop(["a"], axis=1, **kwargs, inplace=True) | ^^^^^^^^^^^^ PD002 25 | x.drop(["a"], axis=1, inplace=True, **kwargs) @@ -144,7 +143,7 @@ PD002.py:26:25: PD002 `inplace=True` should be avoided; it has inconsistent beha 25 | x.drop(["a"], axis=1, inplace=True, **kwargs) 26 | f(x.drop(["a"], axis=1, inplace=True)) | ^^^^^^^^^^^^ PD002 -27 | +27 | 28 | x.apply(lambda x: x.sort_values("a", inplace=True)) | = help: Assign to variable; remove `inplace` arg @@ -152,7 +151,7 @@ PD002.py:26:25: PD002 `inplace=True` should be avoided; it has inconsistent beha PD002.py:28:38: PD002 `inplace=True` should be avoided; it has inconsistent behavior | 26 | f(x.drop(["a"], axis=1, inplace=True)) -27 | +27 | 28 | x.apply(lambda x: x.sort_values("a", inplace=True)) | ^^^^^^^^^^^^ PD002 29 | import torch @@ -162,10 +161,10 @@ PD002.py:28:38: PD002 `inplace=True` should be avoided; it has inconsistent beha PD002.py:33:24: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 31 | torch.m.ReLU(inplace=True) # safe because this isn't a pandas call -32 | +32 | 33 | (x.drop(["a"], axis=1, inplace=True)) | ^^^^^^^^^^^^ PD002 -34 | +34 | 35 | # This method doesn't take exist in Pandas, so ignore it. | = help: Assign to variable; remove `inplace` arg diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap index 82ea7d58cb..a9f1da574b 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD012_pandas_use_of_dot_read_table.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs -snapshot_kind: text --- pandas_use_of_dot_read_table.py:4:6: PD012 Use `.read_csv` instead of `.read_table` to read CSV files | @@ -36,6 +35,6 @@ pandas_use_of_dot_read_table.py:8:6: PD012 Use `.read_csv` instead of `.read_tab 7 | df = pd.read_table(filename, sep=",") 8 | df = pd.read_table(filename, sep=",", header=0) | ^^^^^^^^^^^^^ PD012 - 9 | + 9 | 10 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap index 34df628278..ec4c1808b5 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD101_PD101.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs -snapshot_kind: text --- PD101.py:7:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient | @@ -116,6 +115,6 @@ PD101.py:18:1: PD101 Using `series.nunique()` for checking that a series is cons 17 | data.dropna().nunique() == 1 18 | data[data.notnull()].nunique() == 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101 -19 | +19 | 20 | # No violation of this rule | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap index f15dd43444..f2e5311d5e 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N802_N802.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N802.py:4:5: N802 Function name `Bad` should be lowercase | @@ -33,7 +32,7 @@ N802.py:16:5: N802 Function name `BAD_FUNC` should be lowercase N802.py:40:9: N802 Function name `testTest` should be lowercase | 38 | return super().tearDown() -39 | +39 | 40 | def testTest(self): | ^^^^^^^^ N802 41 | assert True diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap index 992353a4c6..140631d9ff 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N804.py:30:27: N804 [*] First argument of a class method should be named `cls` | 28 | ... -29 | +29 | 30 | def __init_subclass__(self, default_name, **kwargs): | ^^^^ N804 31 | ... @@ -72,7 +71,7 @@ N804.py:54:25: N804 First argument of a class method should be named `cls` N804.py:57:34: N804 First argument of a class method should be named `cls` | 55 | pass -56 | +56 | 57 | def cls_as_pos_only_argument(this, cls, /): | ^^^^ N804 58 | pass @@ -82,7 +81,7 @@ N804.py:57:34: N804 First argument of a class method should be named `cls` N804.py:60:33: N804 First argument of a class method should be named `cls` | 58 | pass -59 | +59 | 60 | def cls_as_kw_only_argument(this, *, cls): | ^^^^ N804 61 | pass @@ -92,7 +91,7 @@ N804.py:60:33: N804 First argument of a class method should be named `cls` N804.py:63:23: N804 First argument of a class method should be named `cls` | 61 | pass -62 | +62 | 63 | def cls_as_varags(this, *cls): | ^^^^ N804 64 | pass @@ -102,7 +101,7 @@ N804.py:63:23: N804 First argument of a class method should be named `cls` N804.py:66:23: N804 First argument of a class method should be named `cls` | 64 | pass -65 | +65 | 66 | def cls_as_kwargs(this, **cls): | ^^^^ N804 67 | pass @@ -136,7 +135,7 @@ N804.py:70:20: N804 [*] First argument of a class method should be named `cls` N804.py:74:20: N804 [*] First argument of a class method should be named `cls` | 72 | this -73 | +73 | 74 | def bad_method(this): | ^^^^ N804 75 | self = this diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap index 59574238ce..89d578bc7f 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N805.py:7:20: N805 [*] First argument of a method should be named `self` | @@ -81,7 +80,7 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` N805.py:63:29: N805 [*] First argument of a method should be named `self` | 61 | pass -62 | +62 | 63 | def bad_method_pos_only(this, blah, /, something: str): | ^^^^ N805 64 | pass @@ -187,7 +186,7 @@ N805.py:98:26: N805 First argument of a method should be named `self` N805.py:101:35: N805 First argument of a method should be named `self` | 99 | pass -100 | +100 | 101 | def self_as_pos_only_argument(this, self, /): | ^^^^ N805 102 | pass @@ -197,7 +196,7 @@ N805.py:101:35: N805 First argument of a method should be named `self` N805.py:104:34: N805 First argument of a method should be named `self` | 102 | pass -103 | +103 | 104 | def self_as_kw_only_argument(this, *, self): | ^^^^ N805 105 | pass @@ -207,7 +206,7 @@ N805.py:104:34: N805 First argument of a method should be named `self` N805.py:107:24: N805 First argument of a method should be named `self` | 105 | pass -106 | +106 | 107 | def self_as_varags(this, *self): | ^^^^ N805 108 | pass @@ -217,7 +216,7 @@ N805.py:107:24: N805 First argument of a method should be named `self` N805.py:110:24: N805 First argument of a method should be named `self` | 108 | pass -109 | +109 | 110 | def self_as_kwargs(this, **self): | ^^^^ N805 111 | pass @@ -251,7 +250,7 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` N805.py:119:20: N805 [*] First argument of a method should be named `self` | 117 | this -118 | +118 | 119 | def bad_method(this): | ^^^^ N805 120 | self = this diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap index f66bba1530..1dbb26dd54 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N806_N806.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N806.py:12:5: N806 Variable `Camel` in function should be lowercase | @@ -33,7 +32,7 @@ N806.py:46:5: N806 Variable `Bad` in function should be lowercase N806.py:53:5: N806 Variable `Bad` in function should be lowercase | 51 | from django.utils.module_loading import import_string -52 | +52 | 53 | Bad = import_string("django.core.exceptions.ValidationError") # N806 | ^^^ N806 54 | ValidationError = import_string("django.core.exceptions.ValidationError") # OK @@ -42,7 +41,7 @@ N806.py:53:5: N806 Variable `Bad` in function should be lowercase N806.py:56:5: N806 Variable `Bad` in function should be lowercase | 54 | ValidationError = import_string("django.core.exceptions.ValidationError") # OK -55 | +55 | 56 | Bad = apps.get_model() # N806 | ^^^ N806 57 | Bad = apps.get_model(model_name="Stream") # N806 @@ -53,7 +52,7 @@ N806.py:57:5: N806 Variable `Bad` in function should be lowercase 56 | Bad = apps.get_model() # N806 57 | Bad = apps.get_model(model_name="Stream") # N806 | ^^^ N806 -58 | +58 | 59 | Address: Type = apps.get_model("zerver", variable) # OK | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap index 680195dbff..c874ee2ad8 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N811_N811.py.snap @@ -43,6 +43,6 @@ N811.py:5:17: N811 Constant `C` imported as non-constant `c` 4 | import mod.CON as c 5 | from mod import C as c | ^^^^^^ N811 -6 | +6 | 7 | # These are all OK: | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap index 57da8ddfae..ab73bb36f1 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N814_N814.py.snap @@ -23,6 +23,6 @@ N814.py:3:17: N814 Camelcase `AnotherCamelCase` imported as constant `ANOTHER_CA 2 | from mod import CamelCase as CAMELCASE 3 | from mod import AnotherCamelCase as ANOTHER_CAMELCASE | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ N814 -4 | +4 | 5 | # These are all OK: | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap index 78972b3152..dfcf9d31f5 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__camelcase_imported_as_incorrect_convention.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N817.py:1:8: N817 CamelCase `CaMel` imported as acronym `CM` | @@ -30,7 +29,7 @@ N817.py:7:23: N817 CamelCase `ElementTree` imported as acronym `ET` 6 | import xml.etree.ElementTree as ET 7 | from xml.etree import ElementTree as ET | ^^^^^^^^^^^^^^^^^ N817 -8 | +8 | 9 | # Always an error (relative import) | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap index ec15dcc3c0..6d28da75c6 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N805.py:7:20: N805 [*] First argument of a method should be named `self` | @@ -43,7 +42,7 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` N805.py:63:29: N805 [*] First argument of a method should be named `self` | 61 | pass -62 | +62 | 63 | def bad_method_pos_only(this, blah, /, something: str): | ^^^^ N805 64 | pass @@ -130,7 +129,7 @@ N805.py:98:26: N805 First argument of a method should be named `self` N805.py:101:35: N805 First argument of a method should be named `self` | 99 | pass -100 | +100 | 101 | def self_as_pos_only_argument(this, self, /): | ^^^^ N805 102 | pass @@ -140,7 +139,7 @@ N805.py:101:35: N805 First argument of a method should be named `self` N805.py:104:34: N805 First argument of a method should be named `self` | 102 | pass -103 | +103 | 104 | def self_as_kw_only_argument(this, *, self): | ^^^^ N805 105 | pass @@ -150,7 +149,7 @@ N805.py:104:34: N805 First argument of a method should be named `self` N805.py:107:24: N805 First argument of a method should be named `self` | 105 | pass -106 | +106 | 107 | def self_as_varags(this, *self): | ^^^^ N805 108 | pass @@ -160,7 +159,7 @@ N805.py:107:24: N805 First argument of a method should be named `self` N805.py:110:24: N805 First argument of a method should be named `self` | 108 | pass -109 | +109 | 110 | def self_as_kwargs(this, **self): | ^^^^ N805 111 | pass @@ -194,7 +193,7 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` N805.py:119:20: N805 [*] First argument of a method should be named `self` | 117 | this -118 | +118 | 119 | def bad_method(this): | ^^^^ N805 120 | self = this diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap index 64d70b7ecf..24d123032c 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N801_N801.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N801.py:4:7: N801 Class name `stillBad` should use CapWords convention | 2 | pass -3 | +3 | 4 | class stillBad: | ^^^^^^^^ N801 5 | pass @@ -14,7 +13,7 @@ N801.py:4:7: N801 Class name `stillBad` should use CapWords convention N801.py:10:7: N801 Class name `STILL_BAD` should use CapWords convention | 8 | pass - 9 | + 9 | 10 | class STILL_BAD: | ^^^^^^^^^ N801 11 | pass diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap index 48d63f69d9..223636244b 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N802_N802.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N802.py:6:5: N802 Function name `stillBad` should be lowercase | 4 | pass -5 | +5 | 6 | def stillBad(): | ^^^^^^^^ N802 7 | pass @@ -14,7 +13,7 @@ N802.py:6:5: N802 Function name `stillBad` should be lowercase N802.py:13:9: N802 Function name `stillBad` should be lowercase | 11 | return super().tearDown() -12 | +12 | 13 | def stillBad(self): | ^^^^^^^^ N802 14 | return super().tearDown() diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap index 7a89eea0d2..6eac6d5d8d 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N803_N803.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N803.py:4:16: N803 Argument name `stillBad` should be lowercase | 2 | return _, a, badAllowed -3 | +3 | 4 | def func(_, a, stillBad): | ^^^^^^^^ N803 5 | return _, a, stillBad @@ -14,7 +13,7 @@ N803.py:4:16: N803 Argument name `stillBad` should be lowercase N803.py:11:28: N803 Argument name `stillBad` should be lowercase | 9 | return _, a, badAllowed -10 | +10 | 11 | def method(self, _, a, stillBad): | ^^^^^^^^ N803 12 | return _, a, stillBad diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap index c8848ff50e..8afa86cd06 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N804.py:5:27: N804 [*] First argument of a class method should be named `cls` | @@ -81,7 +80,7 @@ N804.py:18:20: N804 [*] First argument of a class method should be named `cls` N804.py:21:18: N804 [*] First argument of a class method should be named `cls` | 19 | pass -20 | +20 | 21 | def stillBad(self): | ^^^^ N804 22 | pass diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap index 743bef9166..f6ed863145 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N805.py:7:20: N805 [*] First argument of a method should be named `self` | @@ -24,7 +23,7 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` N805.py:10:18: N805 [*] First argument of a method should be named `self` | 8 | pass - 9 | + 9 | 10 | def stillBad(this): | ^^^^ N805 11 | pass @@ -44,7 +43,7 @@ N805.py:10:18: N805 [*] First argument of a method should be named `self` N805.py:15:24: N805 [*] First argument of a method should be named `self` | 13 | if False: -14 | +14 | 15 | def badAllowed(this): | ^^^^ N805 16 | pass @@ -64,7 +63,7 @@ N805.py:15:24: N805 [*] First argument of a method should be named `self` N805.py:18:22: N805 [*] First argument of a method should be named `self` | 16 | pass -17 | +17 | 18 | def stillBad(this): | ^^^^ N805 19 | pass @@ -169,7 +168,7 @@ N805.py:55:20: N805 First argument of a method should be named `self` N805.py:58:18: N805 First argument of a method should be named `self` | 56 | pass -57 | +57 | 58 | def stillBad(this, blah, /, self, something: str): | ^^^^ N805 59 | pass diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap index 54f0782f26..d5a3d42215 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N806_N806.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N806.py:3:5: N806 Variable `stillBad` in function should be lowercase | @@ -8,7 +7,7 @@ N806.py:3:5: N806 Variable `stillBad` in function should be lowercase 2 | badAllowed = 0 3 | stillBad = 0 | ^^^^^^^^ N806 -4 | +4 | 5 | BAD_ALLOWED = 0 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap index 9efd1ac9ea..c5de6c4f1f 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N807_N807.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N807.py:4:5: N807 Function name should not start and end with `__` | 2 | pass -3 | +3 | 4 | def __stillBad__(): | ^^^^^^^^^^^^ N807 5 | pass @@ -14,7 +13,7 @@ N807.py:4:5: N807 Function name should not start and end with `__` N807.py:12:9: N807 Function name should not start and end with `__` | 10 | pass -11 | +11 | 12 | def __stillBad__(): | ^^^^^^^^^^^^ N807 13 | pass diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap index 48c3b03770..bcd0ed596c 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N811_N811.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N811.py:2:8: N811 Constant `STILL_BAD` imported as non-constant `stillBad` | 1 | import mod.BAD_ALLOWED as badAllowed 2 | import mod.STILL_BAD as stillBad | ^^^^^^^^^^^^^^^^^^^^^^^^^ N811 -3 | +3 | 4 | from mod import BAD_ALLOWED as badAllowed | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap index 59b53b5a98..d198c0546e 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N812_N812.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N812.py:2:8: N812 Lowercase `stillbad` imported as non-lowercase `stillBad` | 1 | import mod.badallowed as badAllowed 2 | import mod.stillbad as stillBad | ^^^^^^^^^^^^^^^^^^^^^^^^ N812 -3 | +3 | 4 | from mod import badallowed as BadAllowed | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap index bff4a4bbd1..021d450283 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N813_N813.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N813.py:2:8: N813 Camelcase `stillBad` imported as lowercase `stillbad` | 1 | import mod.BadAllowed as badallowed 2 | import mod.stillBad as stillbad | ^^^^^^^^^^^^^^^^^^^^^^^^ N813 -3 | +3 | 4 | from mod import BadAllowed as badallowed | @@ -16,7 +15,7 @@ N813.py:5:17: N813 Camelcase `StillBad` imported as lowercase `stillbad` 4 | from mod import BadAllowed as badallowed 5 | from mod import StillBad as stillbad | ^^^^^^^^^^^^^^^^^^^^ N813 -6 | +6 | 7 | from mod import BadAllowed as bad_allowed | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap index e395e7f13d..d5b4ef9e74 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N814_N814.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N814.py:2:8: N814 Camelcase `StillBad` imported as constant `STILLBAD` | 1 | import mod.BadAllowed as BADALLOWED 2 | import mod.StillBad as STILLBAD | ^^^^^^^^^^^^^^^^^^^^^^^^ N814 -3 | +3 | 4 | from mod import BadAllowed as BADALLOWED | @@ -16,7 +15,7 @@ N814.py:5:17: N814 Camelcase `StillBad` imported as constant `STILLBAD` 4 | from mod import BadAllowed as BADALLOWED 5 | from mod import StillBad as STILLBAD | ^^^^^^^^^^^^^^^^^^^^ N814 -6 | +6 | 7 | from mod import BadAllowed as BAD_ALLOWED | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap index 63a2ed9b4e..6712a94c4e 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N815_N815.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N815.py:3:5: N815 Variable `stillBad` in class scope should not be mixedCase | @@ -8,7 +7,7 @@ N815.py:3:5: N815 Variable `stillBad` in class scope should not be mixedCase 2 | badAllowed = 0 3 | stillBad = 0 | ^^^^^^^^ N815 -4 | +4 | 5 | _badAllowed = 0 | @@ -17,7 +16,7 @@ N815.py:6:5: N815 Variable `_stillBad` in class scope should not be mixedCase 5 | _badAllowed = 0 6 | _stillBad = 0 | ^^^^^^^^^ N815 -7 | +7 | 8 | bad_Allowed = 0 | @@ -26,7 +25,7 @@ N815.py:9:5: N815 Variable `still_Bad` in class scope should not be mixedCase 8 | bad_Allowed = 0 9 | still_Bad = 0 | ^^^^^^^^^ N815 -10 | +10 | 11 | class D(TypedDict): | @@ -36,7 +35,7 @@ N815.py:13:5: N815 Variable `stillBad` in class scope should not be mixedCase 12 | badAllowed: bool 13 | stillBad: bool | ^^^^^^^^ N815 -14 | +14 | 15 | _badAllowed: list | @@ -45,7 +44,7 @@ N815.py:16:5: N815 Variable `_stillBad` in class scope should not be mixedCase 15 | _badAllowed: list 16 | _stillBad: list | ^^^^^^^^^ N815 -17 | +17 | 18 | bad_Allowed: set | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap index a29d388089..779cd8fd65 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N816_N816.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N816.py:2:1: N816 Variable `stillBad` in global scope should not be mixedCase | 1 | badAllowed = 0 2 | stillBad = 0 | ^^^^^^^^ N816 -3 | +3 | 4 | _badAllowed = 0 | @@ -16,7 +15,7 @@ N816.py:5:1: N816 Variable `_stillBad` in global scope should not be mixedCase 4 | _badAllowed = 0 5 | _stillBad = 0 | ^^^^^^^^^ N816 -6 | +6 | 7 | bad_Allowed = 0 | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap index 4ab2508d9f..605e62924b 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N817_N817.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N817.py:2:8: N817 CamelCase `StillBad` imported as acronym `SB` | 1 | import mod.BadAllowed as BA 2 | import mod.StillBad as SB | ^^^^^^^^^^^^^^^^^^ N817 -3 | +3 | 4 | from mod import BadAllowed as BA | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap index e33f176810..3a27ac47f0 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N818_N818.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N818.py:4:7: N818 Exception name `StillBad` should be named with an Error suffix | 2 | pass -3 | +3 | 4 | class StillBad(Exception): | ^^^^^^^^ N818 5 | pass @@ -14,7 +13,7 @@ N818.py:4:7: N818 Exception name `StillBad` should be named with an Error suffix N818.py:10:7: N818 Exception name `StillBad` should be named with an Error suffix | 8 | pass - 9 | + 9 | 10 | class StillBad(AnotherError): | ^^^^^^^^ N818 11 | pass diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap index 2f54a26b90..c1a6d0298a 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pep8_naming/mod.rs -snapshot_kind: text --- N805.py:7:20: N805 [*] First argument of a method should be named `self` | @@ -81,7 +80,7 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` N805.py:63:29: N805 [*] First argument of a method should be named `self` | 61 | pass -62 | +62 | 63 | def bad_method_pos_only(this, blah, /, something: str): | ^^^^ N805 64 | pass @@ -168,7 +167,7 @@ N805.py:98:26: N805 First argument of a method should be named `self` N805.py:101:35: N805 First argument of a method should be named `self` | 99 | pass -100 | +100 | 101 | def self_as_pos_only_argument(this, self, /): | ^^^^ N805 102 | pass @@ -178,7 +177,7 @@ N805.py:101:35: N805 First argument of a method should be named `self` N805.py:104:34: N805 First argument of a method should be named `self` | 102 | pass -103 | +103 | 104 | def self_as_kw_only_argument(this, *, self): | ^^^^ N805 105 | pass @@ -188,7 +187,7 @@ N805.py:104:34: N805 First argument of a method should be named `self` N805.py:107:24: N805 First argument of a method should be named `self` | 105 | pass -106 | +106 | 107 | def self_as_varags(this, *self): | ^^^^ N805 108 | pass @@ -198,7 +197,7 @@ N805.py:107:24: N805 First argument of a method should be named `self` N805.py:110:24: N805 First argument of a method should be named `self` | 108 | pass -109 | +109 | 110 | def self_as_kwargs(this, **self): | ^^^^ N805 111 | pass @@ -232,7 +231,7 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` N805.py:119:20: N805 [*] First argument of a method should be named `self` | 117 | this -118 | +118 | 119 | def bad_method(this): | ^^^^ N805 120 | self = this diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap index 35bf8c149c..fd545e1364 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs -snapshot_kind: text --- PERF101.py:7:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 5 | foo_int = 123 -6 | +6 | 7 | for i in list(foo_tuple): # PERF101 | ^^^^^^^^^^^^^^^ PERF101 8 | pass @@ -25,7 +24,7 @@ PERF101.py:7:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 8 | pass - 9 | + 9 | 10 | for i in list(foo_list): # PERF101 | ^^^^^^^^^^^^^^ PERF101 11 | pass @@ -45,7 +44,7 @@ PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 11 | pass -12 | +12 | 13 | for i in list(foo_set): # PERF101 | ^^^^^^^^^^^^^ PERF101 14 | pass @@ -65,7 +64,7 @@ PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 14 | pass -15 | +15 | 16 | for i in list((1, 2, 3)): # PERF101 | ^^^^^^^^^^^^^^^ PERF101 17 | pass @@ -85,7 +84,7 @@ PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 17 | pass -18 | +18 | 19 | for i in list([1, 2, 3]): # PERF101 | ^^^^^^^^^^^^^^^ PERF101 20 | pass @@ -105,7 +104,7 @@ PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 20 | pass -21 | +21 | 22 | for i in list({1, 2, 3}): # PERF101 | ^^^^^^^^^^^^^^^ PERF101 23 | pass @@ -125,7 +124,7 @@ PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 23 | pass -24 | +24 | 25 | for i in list( | __________^ 26 | | { @@ -159,7 +158,7 @@ PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 32 | pass -33 | +33 | 34 | for i in list( # Comment | __________^ 35 | | {1, 2, 3} @@ -184,7 +183,7 @@ PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 55 | foo_list.append(i + 1) -56 | +56 | 57 | for i in list(foo_list): # PERF101 | ^^^^^^^^^^^^^^ PERF101 58 | # Make sure we match the correct list @@ -205,7 +204,7 @@ PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 67 | x, y, nested_tuple = (1, 2, (3, 4, 5)) -68 | +68 | 69 | for i in list(nested_tuple): # PERF101 | ^^^^^^^^^^^^^^^^^^ PERF101 70 | pass @@ -225,7 +224,7 @@ PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating PERF101.py:86:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 84 | import builtins -85 | +85 | 86 | for i in builtins.list(nested_tuple): # PERF101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PERF101 87 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap index 0a6be93231..08e2e86ba5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E101_E101.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E101.py:11:1: E101 Indentation contains mixed spaces and tabs | @@ -8,7 +7,7 @@ E101.py:11:1: E101 Indentation contains mixed spaces and tabs 10 | # E101 11 | print("mixed starts with tab") | ^^^^^^ E101 -12 | +12 | 13 | def func_mixed_start_with_space(): | @@ -18,7 +17,7 @@ E101.py:15:1: E101 Indentation contains mixed spaces and tabs 14 | # E101 15 | print("mixed starts with space") | ^^^^^^^^^^^^^^^ E101 -16 | +16 | 17 | def xyz(): | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap index bc57c17a9d..0aea3ff5f7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E20.py:2:6: E201 [*] Whitespace after '(' | @@ -130,7 +129,7 @@ E20.py:107:6: E201 [*] Whitespace after '[' 106 | #: E201:1:6 107 | spam[ ~ham] | ^ E201 -108 | +108 | 109 | #: Okay | = help: Remove whitespace before '[' @@ -170,7 +169,7 @@ E20.py:145:5: E201 [*] Whitespace after '[' 144 | #: E201:1:5 145 | ham[ : upper] | ^ E201 -146 | +146 | 147 | #: Okay | = help: Remove whitespace before '[' diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap index d8db76fdef..23b47a9a92 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E20.py:19:23: E202 [*] Whitespace before ')' | @@ -152,7 +151,7 @@ E20.py:172:12: E202 [*] Whitespace before ']' 171 | #: E202:1:12 172 | ham[upper : ] | ^ E202 -173 | +173 | 174 | #: E203:1:10 | = help: Remove whitespace before ']' diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap index 82c409afbf..bcac95a6e6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E20.py:51:10: E203 [*] Whitespace before ':' | @@ -192,7 +191,7 @@ E20.py:126:16: E203 [*] Whitespace before ':' 125 | #: E203:1:19 126 | {lower + offset : upper + offset} | ^ E203 -127 | +127 | 128 | #: E203:1:19 | = help: Remove whitespace before ':' @@ -212,7 +211,7 @@ E20.py:129:19: E203 [*] Whitespace before ':' 128 | #: E203:1:19 129 | ham[lower + offset : upper + offset] | ^^ E203 -130 | +130 | 131 | #: Okay | = help: Remove whitespace before ':' @@ -232,7 +231,7 @@ E20.py:157:21: E203 [*] Whitespace before ':' 156 | #: E203:1:21 157 | ham[lower + offset : : upper + offset] | ^ E203 -158 | +158 | 159 | #: E203:1:20 | = help: Remove whitespace before ':' @@ -252,7 +251,7 @@ E20.py:160:20: E203 [*] Whitespace before ':' 159 | #: E203:1:20 160 | ham[lower + offset: :upper + offset] | ^ E203 -161 | +161 | 162 | #: E203:1:20 | = help: Remove whitespace before ':' @@ -272,7 +271,7 @@ E20.py:163:20: E203 [*] Whitespace before ':' 162 | #: E203:1:20 163 | ham[{lower + offset : upper + offset} : upper + offset] | ^ E203 -164 | +164 | 165 | #: Okay | = help: Remove whitespace before ':' @@ -292,7 +291,7 @@ E20.py:175:10: E203 [*] Whitespace before ':' 174 | #: E203:1:10 175 | ham[upper :] | ^^ E203 -176 | +176 | 177 | #: Okay | = help: Remove whitespace before ':' @@ -312,7 +311,7 @@ E20.py:181:14: E203 [*] Whitespace before ':' 180 | #: E203:1:13 181 | ham[lower + 1 :, "columnname"] | ^^ E203 -182 | +182 | 183 | #: Okay | = help: Remove whitespace before ':' @@ -332,7 +331,7 @@ E20.py:187:17: E203 [*] Whitespace before ':' 186 | #: E203:1:13 187 | f"{ham[lower + 1 :, "columnname"]}" | ^^ E203 -188 | +188 | 189 | #: Okay: https://github.com/astral-sh/ruff/issues/12023 | = help: Remove whitespace before ':' diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap index 5a5cd4fad1..ed500ca29f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E22.py:3:6: E221 [*] Multiple spaces before operator | @@ -172,7 +171,7 @@ E22.py:19:14: E221 [*] Multiple spaces before operator E22.py:184:5: E221 [*] Multiple spaces before operator | 182 | #: -183 | +183 | 184 | if a == 1: | ^^ E221 185 | print(a) diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap index 9fd516cd3e..9b6879bfbe 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E22.py:28:8: E222 [*] Multiple spaces after operator | @@ -109,7 +108,7 @@ E22.py:36:7: E222 [*] Multiple spaces after operator E22.py:184:9: E222 [*] Multiple spaces after operator | 182 | #: -183 | +183 | 184 | if a == 1: | ^^ E222 185 | print(a) 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 102fb70ec6..5765ad2908 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E25.py:46:15: E252 [*] Missing whitespace around parameter equals | @@ -279,7 +278,7 @@ E25.py:64:96: E252 [*] Missing whitespace around parameter equals E25.py:67:18: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -299,7 +298,7 @@ E25.py:67:18: E252 [*] Missing whitespace around parameter equals E25.py:67:18: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -319,7 +318,7 @@ E25.py:67:18: E252 [*] Missing whitespace around parameter equals E25.py:67:26: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -339,7 +338,7 @@ E25.py:67:26: E252 [*] Missing whitespace around parameter equals E25.py:67:33: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -359,7 +358,7 @@ E25.py:67:33: E252 [*] Missing whitespace around parameter equals E25.py:67:49: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -379,7 +378,7 @@ E25.py:67:49: E252 [*] Missing whitespace around parameter equals E25.py:67:49: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -399,7 +398,7 @@ E25.py:67:49: E252 [*] Missing whitespace around parameter equals E25.py:67:64: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -419,7 +418,7 @@ E25.py:67:64: E252 [*] Missing whitespace around parameter equals E25.py:67:64: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -439,7 +438,7 @@ E25.py:67:64: E252 [*] Missing whitespace around parameter equals E25.py:67:80: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass @@ -459,7 +458,7 @@ E25.py:67:80: E252 [*] Missing whitespace around parameter equals E25.py:67:96: E252 [*] Missing whitespace around parameter equals | 65 | pass -66 | +66 | 67 | class PEP696Bad[A=int, B =str, C= bool, D:object=int, E: object=str, F: object =bool, G: object= bytes]: | ^ E252 68 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap index 413d87a7fd..a20957b68d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E26.py:4:12: E262 [*] Inline comment should start with `# ` | @@ -92,7 +91,7 @@ E26.py:66:9: E262 [*] Inline comment should start with `# ` 65 | # (Two spaces) Ok for block comment 66 | a = 42 # (Two spaces) | ^^^^^^^^^^^^^^^ E262 -67 | +67 | 68 | #: E265:5:1 | = help: Format space @@ -110,10 +109,10 @@ E26.py:66:9: E262 [*] Inline comment should start with `# ` E26.py:84:8: E262 [*] Inline comment should start with `# ` | 82 | ## Foo -83 | +83 | 84 | a = 1 ## Foo | ^^^^^^ E262 -85 | +85 | 86 | a = 1 #:Foo | = help: Format space @@ -130,7 +129,7 @@ E26.py:84:8: E262 [*] Inline comment should start with `# ` E26.py:86:8: E262 [*] Inline comment should start with `# ` | 84 | a = 1 ## Foo -85 | +85 | 86 | a = 1 #:Foo | ^^^^^ E262 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap index 0e04de2d18..d20b25b5c0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E26.py:10:1: E265 [*] Block comment should start with `# ` | @@ -70,7 +69,7 @@ E26.py:32:1: E265 [*] Block comment should start with `# ` 31 | #: Okay 32 | #!/usr/bin/env python | ^^^^^^^^^^^^^^^^^^^^^ E265 -33 | +33 | 34 | pass # an inline comment | = help: Format space @@ -108,10 +107,10 @@ E26.py:73:1: E265 [*] Block comment should start with `# ` E26.py:78:1: E265 [*] Block comment should start with `# ` | 76 | #: Colon prefix is okay -77 | +77 | 78 | ###This is a variable ### | ^^^^^^^^^^^^^^^^^^^^^^^^^ E265 -79 | +79 | 80 | # We should strip the space, but preserve the hashes. | = help: Format space diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap index d71c78139b..b32057f337 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E26.py:19:5: E266 [*] Too many leading `#` before block comment | 17 | def how_it_feel(r): -18 | +18 | 19 | ### This is a variable ### | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E266 20 | a = 42 @@ -25,7 +24,7 @@ E26.py:19:5: E266 [*] Too many leading `#` before block comment E26.py:22:5: E266 [*] Too many leading `#` before block comment | 20 | a = 42 -21 | +21 | 22 | ### Of course it is unused | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E266 23 | return @@ -90,7 +89,7 @@ E26.py:82:1: E266 [*] Too many leading `#` before block comment 81 | #: E266:1:3 82 | ## Foo | ^^^^^^^ E266 -83 | +83 | 84 | a = 1 ## Foo | = help: Remove leading `#` diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap index d834555835..71f1f1b6f3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E27.py:4:9: E271 [*] Multiple spaces after keyword | @@ -196,7 +195,7 @@ E27.py:71:5: E271 [*] Multiple spaces after keyword 70 | #: E271 71 | type Number = int | ^^ E271 -72 | +72 | 73 | #: E273 | = help: Replace with single space 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 9b2e8fadf6..c7ce1e345d 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E27.py:11:9: E273 [*] Tab after keyword | @@ -112,7 +111,7 @@ E27.py:74:5: E273 [*] Tab after keyword 73 | #: E273 74 | type Number = int | ^^^^ E273 -75 | +75 | 76 | #: E275 | = help: Replace with single space diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap index afe020f83f..5e99bc6e15 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | 2 | # parenthesis. -3 | +3 | 4 | def foo[T1, T2(): | ^ 5 | pass @@ -34,11 +33,11 @@ E30_syntax_error.py:15:5: E301 Expected 1 blank line, found 0 E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline | 16 | pass -17 | +17 | 18 | foo = Foo( | ^ -19 | -20 | +19 | +20 | 21 | def top( | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap index a276cd51e8..5c422baa3d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 | @@ -47,7 +46,7 @@ E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 | 547 | pass -548 | +548 | 549 | def b(): | ^^^ E302 550 | pass @@ -67,7 +66,7 @@ E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 | 558 | # comment -559 | +559 | 560 | def b(): | ^^^ E302 561 | pass @@ -87,7 +86,7 @@ E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 | 567 | pass -568 | +568 | 569 | async def b(): | ^^^^^ E302 570 | pass @@ -107,7 +106,7 @@ E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 | 576 | pass -577 | +577 | 578 | async def x(y: int = 1): | ^^^^^ E302 579 | pass @@ -207,7 +206,7 @@ E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 | 632 | def fn(a: str) -> str: ... -633 | +633 | 634 | def fn(a: int | str) -> int | str: | ^^^ E302 635 | ... diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap index ef9c640138..9e725801e0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E302_first_line_docstring.py:3:1: E302 [*] Expected 2 blank lines, found 1 | 1 | """Test where the error is after the module's docstring.""" -2 | +2 | 3 | def fn(): | ^^^ E302 4 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap index 2626b10faa..ecbe189c76 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E302_first_line_expression.py:3:1: E302 [*] Expected 2 blank lines, found 1 | 1 | "Test where the first line is a comment, " + "and the rule violation follows it." -2 | +2 | 3 | def fn(): | ^^^ E302 4 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap index ac34dfa6a0..cd03aac657 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E302_first_line_function.py:4:1: E302 [*] Expected 2 blank lines, found 1 | 2 | pass -3 | +3 | 4 | def fn2(): | ^^^ E302 5 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap index 00f4d5d72d..ac0bdf5e2e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E302_first_line_statement.py:3:1: E302 [*] Expected 2 blank lines, found 1 | 1 | print("Test where the first line is a statement, and the rule violation follows it.") -2 | +2 | 3 | def fn(): | ^^^ E302 4 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap index 5be869e719..88d95e3ee9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | 2 | # parenthesis. -3 | +3 | 4 | def foo[T1, T2(): | ^ 5 | pass @@ -14,7 +13,7 @@ E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' E30_syntax_error.py:7:1: E302 Expected 2 blank lines, found 1 | 5 | pass -6 | +6 | 7 | def bar(): | ^^^ E302 8 | pass @@ -34,11 +33,11 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline | 16 | pass -17 | +17 | 18 | foo = Foo( | ^ -19 | -20 | +19 | +20 | 21 | def top( | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap index 3f5868e45b..5e8f5f9e9c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.py:617:2: E303 [*] Too many blank lines (2) | @@ -24,7 +23,7 @@ E30.py:644:5: E303 [*] Too many blank lines (2) | 644 | # arbitrary comment | ^^^^^^^^^^^^^^^^^^^ E303 -645 | +645 | 646 | def inner(): # E306 not expected (pycodestyle detects E306) | = help: Remove extraneous blank line(s) @@ -77,7 +76,7 @@ E30.py:676:1: E303 [*] Too many blank lines (3) | 676 | # comment | ^^^^^^^^^ E303 -677 | +677 | 678 | print() | = help: Remove extraneous blank line(s) @@ -111,7 +110,7 @@ E30.py:690:5: E303 [*] Too many blank lines (2) | 690 | # another comment | ^^^^^^^^^^^^^^^^^ E303 -691 | +691 | 692 | print() | = help: Remove extraneous blank line(s) @@ -199,7 +198,7 @@ E30.py:734:5: E303 [*] Too many blank lines (2) | 734 | # another comment | ^^^^^^^^^^^^^^^^^ E303 -735 | +735 | 736 | def test(self): pass | = help: Remove extraneous blank line(s) diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap index 2744d695ab..f268b987e1 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | 2 | # parenthesis. -3 | +3 | 4 | def foo[T1, T2(): | ^ 5 | pass @@ -33,11 +32,11 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline | 16 | pass -17 | +17 | 18 | foo = Foo( | ^ -19 | -20 | +19 | +20 | 21 | def top( | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap index dd9f6cb151..fe68174f76 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.py:765:1: E304 [*] Blank lines found after function decorator (1) | 763 | @decorator -764 | +764 | 765 | def function(): | ^^^ E304 766 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap index c5167d251d..482f2d428e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | @@ -41,7 +40,7 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 819 | # another comment -820 | +820 | 821 | try: | ^^^ E305 822 | fn() @@ -80,7 +79,7 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 844 | blah, blah -845 | +845 | 846 | if __name__ == '__main__': | ^^ E305 847 | main() diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap index cee866c200..6d5796ccab 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | 2 | # parenthesis. -3 | +3 | 4 | def foo[T1, T2(): | ^ 5 | pass @@ -24,7 +23,7 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline E30_syntax_error.py:18:1: E305 Expected 2 blank lines after class or function definition, found (1) | 16 | pass -17 | +17 | 18 | foo = Foo( | ^^^ E305 | @@ -33,11 +32,11 @@ E30_syntax_error.py:18:1: E305 Expected 2 blank lines after class or function de E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline | 16 | pass -17 | +17 | 18 | foo = Foo( | ^ -19 | -20 | +19 | +20 | 21 | def top( | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap index 81b10e944c..226c3ad35a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30_syntax_error.py:4:15: SyntaxError: Expected ']', found '(' | 2 | # parenthesis. -3 | +3 | 4 | def foo[T1, T2(): | ^ 5 | pass @@ -24,11 +23,11 @@ E30_syntax_error.py:13:18: SyntaxError: Expected ')', found newline E30_syntax_error.py:18:11: SyntaxError: Expected ')', found newline | 16 | pass -17 | +17 | 18 | foo = Foo( | ^ -19 | -20 | +19 | +20 | 21 | def top( | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap index d1b610481a..86b9b31306 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E40.py:2:1: E401 [*] Multiple imports on one line | 1 | #: E401 2 | import os, sys | ^^^^^^^^^^^^^^ E401 -3 | +3 | 4 | #: Okay | = help: Split imports @@ -47,7 +46,7 @@ E40.py:66:1: E401 [*] Multiple imports on one line 65 | import re as regex, string # also with a comment! 66 | import re as regex, string; x = 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 -67 | +67 | 68 | x = 1; import re as regex, string | = help: Split imports @@ -65,7 +64,7 @@ E40.py:66:1: E401 [*] Multiple imports on one line E40.py:68:8: E401 [*] Multiple imports on one line | 66 | import re as regex, string; x = 1 -67 | +67 | 68 | x = 1; import re as regex, string | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 | @@ -86,7 +85,7 @@ E40.py:72:5: E401 [*] Multiple imports on one line 71 | def blah(): 72 | import datetime as dt, copy | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 -73 | +73 | 74 | def nested_and_tested(): | = help: Split imports @@ -107,7 +106,7 @@ E40.py:75:9: E401 [*] Multiple imports on one line 74 | def nested_and_tested(): 75 | import builtins, textwrap as tw | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 -76 | +76 | 77 | x = 1; import re as regex, string | = help: Split imports @@ -126,7 +125,7 @@ E40.py:75:9: E401 [*] Multiple imports on one line E40.py:77:16: E401 [*] Multiple imports on one line | 75 | import builtins, textwrap as tw -76 | +76 | 77 | x = 1; import re as regex, string | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 78 | import re as regex, string; x = 1 @@ -148,7 +147,7 @@ E40.py:78:9: E401 [*] Multiple imports on one line 77 | x = 1; import re as regex, string 78 | import re as regex, string; x = 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 -79 | +79 | 80 | if True: import re as regex, string | = help: Split imports @@ -165,7 +164,7 @@ E40.py:78:9: E401 [*] Multiple imports on one line E40.py:80:14: E401 [*] Multiple imports on one line | 78 | import re as regex, string; x = 1 -79 | +79 | 80 | if True: import re as regex, string | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E401 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap index 44bf5bc21a..bbf2e510a7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E40.py:56:1: E402 Module level import not at top of file | 54 | VERSION = '1.2.3' -55 | +55 | 56 | import foo | ^^^^^^^^^^ E402 57 | #: E402 @@ -18,17 +17,17 @@ E40.py:58:1: E402 Module level import not at top of file 57 | #: E402 58 | import foo | ^^^^^^^^^^ E402 -59 | +59 | 60 | a = 1 | E40.py:62:1: E402 Module level import not at top of file | 60 | a = 1 -61 | +61 | 62 | import bar | ^^^^^^^^^^ E402 -63 | +63 | 64 | #: E401 | @@ -46,14 +45,14 @@ E40.py:66:1: E402 Module level import not at top of file 65 | import re as regex, string # also with a comment! 66 | import re as regex, string; x = 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E402 -67 | +67 | 68 | x = 1; import re as regex, string | E40.py:68:8: E402 Module level import not at top of file | 66 | import re as regex, string; x = 1 -67 | +67 | 68 | x = 1; import re as regex, string | ^^^^^^^^^^^^^^^^^^^^^^^^^^ E402 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap index 57da2d9c81..9cbf106ef9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402.ipynb.snap @@ -1,21 +1,20 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E402.ipynb:9:1: E402 Module level import not at top of cell | 7 | os.path - 8 | + 8 | 9 | import pathlib | ^^^^^^^^^^^^^^ E402 -10 | +10 | 11 | import a | E402.ipynb:22:1: E402 Module level import not at top of cell | 20 | __some__magic = 1 -21 | +21 | 22 | import c | ^^^^^^^^ E402 23 | import ok @@ -25,6 +24,6 @@ E402.ipynb:30:1: E402 Module level import not at top of cell | 30 | import no_ok | ^^^^^^^^^^^^ E402 -31 | +31 | 32 | %%time | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap index be3142cbab..dff5430ecb 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_0.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E402_0.py:35:1: E402 Module level import not at top of file | 33 | __some__magic = 1 -34 | +34 | 35 | import h | ^^^^^^^^ E402 | @@ -13,7 +12,7 @@ E402_0.py:35:1: E402 Module level import not at top of file E402_0.py:45:1: E402 Module level import not at top of file | 43 | import j -44 | +44 | 45 | import k; import l | ^^^^^^^^ E402 | @@ -21,7 +20,7 @@ E402_0.py:45:1: E402 Module level import not at top of file E402_0.py:45:11: E402 Module level import not at top of file | 43 | import j -44 | +44 | 45 | import k; import l | ^^^^^^^^ E402 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap index 29be45489e..a035c4d914 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E402_1.py.snap @@ -1,21 +1,20 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E402_1.py:5:1: E402 Module level import not at top of file | 3 | """Some other docstring.""" -4 | +4 | 5 | import b | ^^^^^^^^ E402 -6 | +6 | 7 | """Some other docstring.""" | E402_1.py:9:1: E402 Module level import not at top of file | 7 | """Some other docstring.""" -8 | +8 | 9 | import c | ^^^^^^^^ E402 | 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 242bbe9bc3..133712eea9 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` | @@ -169,7 +168,7 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | 24 | pass -25 | +25 | 26 | if x == None != None: | ^^^^ E711 27 | pass @@ -189,7 +188,7 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | 24 | pass -25 | +25 | 26 | if x == None != None: | ^^^^ E711 27 | pass 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 4dc4f086ec..02f2c26951 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E712.py:2:4: E712 [*] Avoid equality comparisons to `True`; use `if res:` for truth checks | @@ -190,7 +189,7 @@ E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | 23 | pass -24 | +24 | 25 | if res == True != False: | ^^^^^^^^^^^^^^^^^^^^ E712 26 | pass @@ -210,7 +209,7 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | 23 | pass -24 | +24 | 25 | if res == True != False: | ^^^^^^^^^^^^^^^^^^^^ E712 26 | pass @@ -230,7 +229,7 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks | 26 | pass -27 | +27 | 28 | if(True) == TrueElement or x == TrueElement: | ^^^^^^^^^^^^^^^^^^^^^ E712 29 | pass @@ -250,7 +249,7 @@ E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` for truth checks | 29 | pass -30 | +30 | 31 | if (yield i) == True: | ^^^^^^^^^^^^^^^^^ E712 32 | print("even") diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap index 076396f50b..0e257342a9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E721_E721.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E721.py:2:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks | @@ -145,14 +144,14 @@ E721.py:140:1: E721 Use `is` and `is not` for type comparisons, or `isinstance() 139 | #: E721 140 | dtype == float | ^^^^^^^^^^^^^^ E721 -141 | +141 | 142 | import builtins | E721.py:144:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks | 142 | import builtins -143 | +143 | 144 | if builtins.type(res) == memoryview: # E721 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E721 145 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap index 93badbdb67..75db1277a6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E741_E741.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E741.py:3:1: E741 Ambiguous variable name: `l` | 1 | from contextlib import contextmanager -2 | +2 | 3 | l = 0 | ^ E741 4 | I = 0 @@ -36,14 +35,14 @@ E741.py:6:1: E741 Ambiguous variable name: `l` 5 | O = 0 6 | l: int = 0 | ^ E741 -7 | +7 | 8 | a, l = 0, 1 | E741.py:8:4: E741 Ambiguous variable name: `l` | 6 | l: int = 0 - 7 | + 7 | 8 | a, l = 0, 1 | ^ E741 9 | [a, l] = 0, 1 @@ -74,14 +73,14 @@ E741.py:11:5: E741 Ambiguous variable name: `l` 10 | a, *l = 0, 1, 2 11 | a = l = 0 | ^ E741 -12 | +12 | 13 | o = 0 | E741.py:16:5: E741 Ambiguous variable name: `l` | 14 | i = 0 -15 | +15 | 16 | for l in range(3): | ^ E741 17 | pass @@ -115,7 +114,7 @@ E741.py:30:5: E741 Ambiguous variable name: `l` 29 | def f2(): 30 | l = 0 | ^ E741 -31 | +31 | 32 | def f3(): | @@ -133,7 +132,7 @@ E741.py:34:9: E741 Ambiguous variable name: `l` 33 | nonlocal l 34 | l = 1 | ^ E741 -35 | +35 | 36 | f3() | @@ -205,7 +204,7 @@ E741.py:71:22: E741 Ambiguous variable name: `l` E741.py:74:5: E741 Ambiguous variable name: `l` | 72 | pass -73 | +73 | 74 | if (l := 5) > 0: | ^ E741 75 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap index a75ff6e87f..0f59c043ac 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- W291.py:1:23: W291 [*] Trailing whitespace | @@ -20,7 +19,7 @@ W291.py:1:23: W291 [*] Trailing whitespace W291.py:4:24: W291 [*] Trailing whitespace | 2 | inside a multiline string''' -3 | +3 | 4 | f'''trailing whitespace | ^ W291 5 | inside a multiline f-string''' 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 4159318729..8da92669c3 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.` | 1 | #: W605:1:10 2 | regex = '\.png$' | ^^ W605 -3 | +3 | 4 | #: W605:2:1 | = help: Use a raw string literal @@ -105,7 +104,7 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` 27 | #: W605:1:11 28 | return'\.png$' | ^^ W605 -29 | +29 | 30 | #: Okay | = help: Use a raw string literal @@ -123,10 +122,10 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` | 43 | ''' # noqa -44 | +44 | 45 | regex = '\\\_' | ^^ W605 -46 | +46 | 47 | #: W605:1:7 | = help: Add backslash to escape sequence @@ -146,7 +145,7 @@ W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` 47 | #: W605:1:7 48 | u'foo\ bar' | ^^ W605 -49 | +49 | 50 | #: W605:1:13 | = help: Use a raw string literal @@ -186,7 +185,7 @@ W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` 56 | #: W605:1:6 57 | "foo \. bar \t" | ^^ W605 -58 | +58 | 59 | #: W605:1:13 | = help: Add backslash to escape sequence 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 9e49faa228..8d763a16a3 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 @@ -6,7 +6,7 @@ W605_1.py:4:11: W605 [*] Invalid escape sequence: `\.` 3 | #: W605:1:10 4 | regex = f'\.png$' | ^^ W605 -5 | +5 | 6 | #: W605:2:1 | = help: Use a raw string literal @@ -103,7 +103,7 @@ W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` | 41 | ''' # noqa -42 | +42 | 43 | regex = f'\\\_' | ^^ W605 44 | value = f'\{{1}}' @@ -209,7 +209,7 @@ W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` 47 | value = f"{f"\{1}"}" 48 | value = rf"{f"\{1}"}" | ^^ W605 -49 | +49 | 50 | # Okay | = help: Use a raw string literal @@ -270,7 +270,7 @@ W605_1.py:59:12: W605 [*] Invalid escape sequence: `\d` 58 | f"\n{{}}+-\d+" 59 | f"\n{{}}�+-\d+" | ^^ W605 -60 | +60 | 61 | # See https://github.com/astral-sh/ruff/issues/11491 | = help: Add backslash to escape sequence @@ -291,7 +291,7 @@ W605_1.py:65:31: W605 [*] Invalid escape sequence: `\I` 64 | incomplete = 3 65 | s = f"TOTAL: {total}\nOK: {ok}\INCOMPLETE: {incomplete}\n" | ^^ W605 -66 | +66 | 67 | # Debug text (should trigger) | = help: Add backslash to escape sequence diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap index 057bf5f941..3a2fa4505d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.ipynb:21:1: E302 [*] Expected 2 blank lines, found 1 | 19 | pass -20 | +20 | 21 | def b(): | ^^^ E302 22 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap index ec883dae31..2ccc9b5a56 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.ipynb:29:5: E303 [*] Too many blank lines (2) | 29 | # arbitrary comment | ^^^^^^^^^^^^^^^^^^^ E303 -30 | +30 | 31 | def inner(): # E306 not expected (pycodestyle detects E306) | = help: Remove extraneous blank line(s) diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap index 785066990f..39fbc5b80f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E30.ipynb:45:1: E304 [*] Blank lines found after function decorator (1) | 43 | @decorator -44 | +44 | 45 | def function(): | ^^^ E304 46 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap index c976d4c5f6..a5c5cd23e7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- W505.py:2:51: W505 Doc line too long (57 > 50) | @@ -14,17 +13,17 @@ W505.py:6:51: W505 Doc line too long (56 > 50) 5 | def f1(): 6 | """Here's a docstring that's also over the limit.""" | ^^^^^^ W505 -7 | +7 | 8 | x = 1 # Here's a comment that's over the limit, but it's not standalone. | W505.py:10:51: W505 Doc line too long (56 > 50) | 8 | x = 1 # Here's a comment that's over the limit, but it's not standalone. - 9 | + 9 | 10 | # Here's a standalone comment that's over the limit. | ^^^^^^ W505 -11 | +11 | 12 | x = 2 | @@ -33,7 +32,7 @@ W505.py:13:51: W505 Doc line too long (94 > 50) 12 | x = 2 13 | # Another standalone that is preceded by a newline and indent token and is over the limit. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ W505 -14 | +14 | 15 | print("Here's a string that's over the limit, but it's not a docstring.") | @@ -46,7 +45,7 @@ W505.py:18:51: W505 Doc line too long (61 > 50) W505.py:24:51: W505 Doc line too long (82 > 50) | 22 | """Here's a multi-line docstring. -23 | +23 | 24 | It's over the limit on this line, which isn't the first line in the docstring. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ W505 25 | """ @@ -55,7 +54,7 @@ W505.py:24:51: W505 Doc line too long (82 > 50) W505.py:31:51: W505 Doc line too long (85 > 50) | 29 | """Here's a multi-line docstring. -30 | +30 | 31 | It's over the limit on this line, which isn't the first line in the docstring.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ W505 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap index 151742374c..64f4347ec6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- W505_utf_8.py:2:50: W505 Doc line too long (57 > 50) | @@ -14,17 +13,17 @@ W505_utf_8.py:6:49: W505 Doc line too long (56 > 50) 5 | def f1(): 6 | """Here's a ß9💣2ℝing that's also over theß9💣2ℝ.""" | ^^^^^^ W505 -7 | +7 | 8 | x = 1 # Here's a comment that's over theß9💣2ℝ, but it's not standalone. | W505_utf_8.py:10:51: W505 Doc line too long (56 > 50) | 8 | x = 1 # Here's a comment that's over theß9💣2ℝ, but it's not standalone. - 9 | + 9 | 10 | # Here's a standalone comment that's over theß9💣2ℝ. | ^^^^^^ W505 -11 | +11 | 12 | x = 2 | @@ -33,7 +32,7 @@ W505_utf_8.py:13:51: W505 Doc line too long (94 > 50) 12 | x = 2 13 | # Another standalone that is preceded by a newline and indent token and is over theß9💣2ℝ. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ W505 -14 | +14 | 15 | print("Here's a string that's over theß9💣2ℝ, but it's not a ß9💣2ℝing.") | @@ -46,7 +45,7 @@ W505_utf_8.py:18:50: W505 Doc line too long (61 > 50) W505_utf_8.py:24:50: W505 Doc line too long (82 > 50) | 22 | """Here's a multi-line ß9💣2ℝing. -23 | +23 | 24 | It's over theß9💣2ℝ on this line, which isn't the first line in the ß9💣2ℝing. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ W505 25 | """ @@ -55,7 +54,7 @@ W505_utf_8.py:24:50: W505 Doc line too long (82 > 50) W505_utf_8.py:31:50: W505 Doc line too long (85 > 50) | 29 | """Here's a multi-line ß9💣2ℝing. -30 | +30 | 31 | It's over theß9💣2ℝ on this line, which isn't the first line in the ß9💣2ℝing.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ W505 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap index d28418368a..fe398c0aa1 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E502.py:9:9: E502 [*] Redundant backslash | 7 | + 4 - 8 | + 8 | 9 | a = (3 -\ | ^ E502 10 | 2 + \ @@ -247,7 +246,7 @@ E502.py:61:9: E502 [*] Redundant backslash E502.py:82:12: E502 [*] Redundant backslash | 80 | "xyz" -81 | +81 | 82 | x = ("abc" \ | ^ E502 83 | "xyz") diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap index 6007618c85..f6afa64ada 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- W391_0.py:14:1: W391 [*] Extra newline at end of file | 12 | foo() 13 | bar() -14 | +14 | | ^ W391 | = help: Remove trailing newline diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap index ff6d0984c1..2b5a0222b2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E501_2.py:2:7: E501 Line too long (7 > 6) | @@ -37,7 +36,7 @@ E501_2.py:10:7: E501 Line too long (7 > 6) 9 | # aa 10 | # aaa | ^ E501 -11 | +11 | 12 | if True: # noqa: E501 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap index 311ebe1d1e..bfc312b4dc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E501_2.py:2:7: E501 Line too long (7 > 6) | @@ -66,7 +65,7 @@ E501_2.py:10:5: E501 Line too long (9 > 6) 9 | # aa 10 | # aaa | ^^^ E501 -11 | +11 | 12 | if True: # noqa: E501 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap index f9a2e5c4f5..9930bcbee3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_4.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E501_2.py:2:7: E501 Line too long (7 > 6) | @@ -86,7 +85,7 @@ E501_2.py:10:3: E501 Line too long (13 > 6) 9 | # aa 10 | # aaa | ^^^^^ E501 -11 | +11 | 12 | if True: # noqa: E501 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap index b120644711..2f3422d92f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_8.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs -snapshot_kind: text --- E501_2.py:2:7: E501 Line too long (7 > 6) | @@ -86,7 +85,7 @@ E501_2.py:10:2: E501 Line too long (21 > 6) 9 | # aa 10 | # aaa | ^^^^^^^^^ E501 -11 | +11 | 12 | if True: # noqa: E501 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap index e61807f3cb..c8cf6f9ab7 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D101_D.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D.py:15:7: D101 Missing docstring in public class | 15 | class class_: | ^^^^^^ D101 -16 | +16 | 17 | expect('meta', 'D419: Docstring is empty') | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap index b3c6872247..6fd782e2ce 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D107_D.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D.py:60:9: D107 Missing docstring in `__init__` | @@ -13,7 +12,7 @@ D.py:60:9: D107 Missing docstring in `__init__` D.py:534:9: D107 Missing docstring in `__init__` | 532 | """ -533 | +533 | 534 | def __init__(self, x): | ^^^^^^^^ D107 535 | pass 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 5a4488570e..5d400736ed 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D202.py:57:5: D202 [*] No blank lines allowed after function docstring (found 2) | @@ -46,7 +45,7 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) 79 | def outer(): 80 | """This is a docstring.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^ D202 -81 | +81 | 82 | # This is a comment. | = help: Remove blank line(s) after function docstring 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 12349f4b85..8f7d860a3c 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D.py:181:5: D204 [*] 1 blank line required after class docstring | 179 | class TrailingSpace: -180 | +180 | 181 | """TrailingSpace.""" | ^^^^^^^^^^^^^^^^^^^^ D204 182 | pass 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 35753cd8af..affb5b409e 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D.py:170:5: D211 [*] No blank lines allowed before class docstring | 168 | class WithLeadingSpace: -169 | +169 | 170 | """With leading space.""" | ^^^^^^^^^^^^^^^^^^^^^^^^^ D211 | @@ -23,7 +22,7 @@ D.py:170:5: D211 [*] No blank lines allowed before class docstring D.py:181:5: D211 [*] No blank lines allowed before class docstring | 179 | class TrailingSpace: -180 | +180 | 181 | """TrailingSpace.""" | ^^^^^^^^^^^^^^^^^^^^ D211 182 | pass 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 31154618e4..dc344a0cc0 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D214_module.py:3:5: D214 [*] Section is over-indented ("Returns") | 1 | """A module docstring with D214 violations -2 | +2 | 3 | Returns | ^^^^^^^ D214 4 | ----- @@ -25,7 +24,7 @@ D214_module.py:3:5: D214 [*] Section is over-indented ("Returns") D214_module.py:7:5: D214 [*] Section is over-indented ("Args") | 5 | valid returns -6 | +6 | 7 | Args | ^^^^ D214 8 | ----- 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 ae3e3a73f2..371f690de1 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- sections.py:146:9: D214 [*] Section is over-indented ("Returns") | 144 | """Toggle the gizmo. -145 | +145 | 146 | Returns | ^^^^^^^ D214 147 | ------- @@ -26,7 +25,7 @@ sections.py:146:9: D214 [*] Section is over-indented ("Returns") sections.py:563:9: D214 [*] Section is over-indented ("Returns") | 561 | Here's a note. -562 | +562 | 563 | Returns: | ^^^^^^^ D214 564 | """ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D402.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D402.py.snap index aa693f8397..1c23d91dc9 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D402.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D402_D402.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D402.py:2:5: D402 First line should not be the function's signature | 1 | def foo(): 2 | """Returns foo().""" | ^^^^^^^^^^^^^^^^^^^^ D402 -3 | +3 | 4 | def foo(): | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap index a4e7ad8bae..dec763cf08 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D404_D.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D.py:631:5: D404 First word of the docstring should not be "This" | @@ -22,14 +21,14 @@ D.py:639:17: D404 First word of the docstring should not be "This" | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D404 -640 | +640 | 641 | def same_line(): """This is a docstring on the same line""" | D.py:641:18: D404 First word of the docstring should not be "This" | 639 | class SameLine: """This is a docstring on the same line""" -640 | +640 | 641 | def same_line(): """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D404 | 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 2ec0f5de03..840beb1830 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 @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/pydocstyle/mod.rs sections.py:19:5: D405 [*] Section name should be properly capitalized ("returns") | 17 | """Toggle the gizmo. -18 | +18 | 19 | returns | ^^^^^^^ D405 20 | ------- @@ -25,7 +25,7 @@ sections.py:19:5: D405 [*] Section name should be properly capitalized ("returns sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short summary") | 216 | """Toggle the gizmo. -217 | +217 | 218 | Short summary | ^^^^^^^^^^^^^ D405 219 | ------------- @@ -45,7 +45,7 @@ sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short sections.py:573:5: D405 [*] Section name should be properly capitalized ("returns") | 571 | arg: Here's a note. -572 | +572 | 573 | returns: | ^^^^^^^ D405 574 | Here's another note. 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 9a557902ae..d5914e8da6 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 @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/pydocstyle/mod.rs sections.py:32:5: D406 [*] Section name should end with a newline ("Returns") | 30 | """Toggle the gizmo. -31 | +31 | 32 | Returns: | ^^^^^^^ D406 33 | ------- @@ -45,7 +45,7 @@ sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") sections.py:601:5: D406 [*] Section name should end with a newline ("Parameters") | 599 | """Test that lower case subsection header is valid even if it has the same name as section kind. -600 | +600 | 601 | Parameters: | ^^^^^^^^^^ D406 602 | ---------- 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 9186570757..767809f849 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 @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/pydocstyle/mod.rs sections.py:44:5: D407 [*] Missing dashed underline after section ("Returns") | 42 | """Toggle the gizmo. -43 | +43 | 44 | Returns | ^^^^^^^ D407 45 | A value of some sort. @@ -23,10 +23,10 @@ sections.py:44:5: D407 [*] Missing dashed underline after section ("Returns") sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") | 54 | """Toggle the gizmo. -55 | +55 | 56 | Returns | ^^^^^^^ D407 -57 | +57 | 58 | """ | = help: Add dashed line under "Returns" @@ -43,7 +43,7 @@ sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") | 65 | """Toggle the gizmo. -66 | +66 | 67 | Returns""" | ^^^^^^^ D407 | @@ -120,7 +120,7 @@ sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters" sections.py:613:4: D407 [*] Missing dashed underline after section ("Parameters") | 611 | """Test that lower case subsection header is valid even if it is of a different kind. -612 | +612 | 613 | Parameters | ^^^^^^^^^^ D407 614 | -‐----------------- 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 843296208e..2bb4847569 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- sections.py:98:5: D408 [*] Section underline should be in the line following the section's name ("Returns") | 96 | Returns -97 | +97 | 98 | ------- | ^^^^^^^ D408 99 | A value of some sort. 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 dd457b8796..f95ac4dd1f 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D410.py:4:5: D410 [*] Missing blank line after section ("Parameters") | 2 | """Showcase function. -3 | +3 | 4 | Parameters | ^^^^^^^^^^ D410 5 | ---------- @@ -25,7 +24,7 @@ D410.py:4:5: D410 [*] Missing blank line after section ("Parameters") D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") | 19 | """Showcase function. -20 | +20 | 21 | Parameters | ^^^^^^^^^^ D410 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 246475689e..389391bb46 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- sections.py:78:5: D410 [*] Missing blank line after section ("Returns") | 76 | """Toggle the gizmo. -77 | +77 | 78 | Returns | ^^^^^^^ D410 79 | ------- @@ -25,7 +24,7 @@ sections.py:78:5: D410 [*] Missing blank line after section ("Returns") sections.py:224:5: D410 [*] Missing blank line after section ("Returns") | 222 | returns. -223 | +223 | 224 | Returns | ^^^^^^^ D410 225 | ------ 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 8f48cccc69..6616be7a6e 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- sections.py:218:5: D412 [*] No blank lines allowed between a section header and its content ("Short summary") | 216 | """Toggle the gizmo. -217 | +217 | 218 | Short summary | ^^^^^^^^^^^^^ D412 219 | ------------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap index 7aa16a9e29..d1339c1a8a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D413.py:7:1: D413 [*] Missing blank line after last section ("Returns") | 5 | with a hanging indent -6 | +6 | 7 | Returns: | ^^^^^^^ D413 8 | the value @@ -25,7 +24,7 @@ D413.py:7:1: D413 [*] Missing blank line after last section ("Returns") D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") | 17 | with a hanging indent -18 | +18 | 19 | Returns: | ^^^^^^^ D413 20 | the value @@ -45,7 +44,7 @@ D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") | 56 | with a hanging indent -57 | +57 | 58 | Returns: | ^^^^^^^ D413 59 | the value""" @@ -67,7 +66,7 @@ D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") D413.py:69:5: D413 [*] Missing blank line after last section ("Returns") | 67 | with a hanging indent -68 | +68 | 69 | Returns: | ^^^^^^^ D413 70 | the value diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap index 9e32aa1a23..c8e9fd19ae 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 @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/pydocstyle/mod.rs sections.py:67:5: D413 [*] Missing blank line after last section ("Returns") | 65 | """Toggle the gizmo. -66 | +66 | 67 | Returns""" | ^^^^^^^ D413 | @@ -25,7 +25,7 @@ sections.py:67:5: D413 [*] Missing blank line after last section ("Returns") sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") | 120 | """Toggle the gizmo. -121 | +121 | 122 | Returns | ^^^^^^^ D413 123 | ------- @@ -45,7 +45,7 @@ sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") | 170 | """Toggle the gizmo. -171 | +171 | 172 | Returns | ^^^^^^^ D413 173 | ------- @@ -65,7 +65,7 @@ sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") | 519 | """Equal length equals should be replaced with dashes. -520 | +520 | 521 | Parameters | ^^^^^^^^^^ D413 522 | ========== @@ -85,7 +85,7 @@ sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") | 527 | """Here, the length of equals is not the same. -528 | +528 | 529 | Parameters | ^^^^^^^^^^ D413 530 | =========== @@ -105,7 +105,7 @@ sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") sections.py:550:5: D413 [*] Missing blank line after last section ("Args") | 548 | """Below, `returns:` should _not_ be considered a section header. -549 | +549 | 550 | Args: | ^^^^ D413 551 | Here's a note. @@ -124,7 +124,7 @@ sections.py:550:5: D413 [*] Missing blank line after last section ("Args") sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") | 561 | Here's a note. -562 | +562 | 563 | Returns: | ^^^^^^^ D413 564 | """ @@ -143,7 +143,7 @@ sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") sections.py:573:5: D413 [*] Missing blank line after last section ("returns") | 571 | arg: Here's a note. -572 | +572 | 573 | returns: | ^^^^^^^ D413 574 | Here's another note. @@ -163,7 +163,7 @@ sections.py:573:5: D413 [*] Missing blank line after last section ("returns") sections.py:601:5: D413 [*] Missing blank line after last section ("Parameters") | 599 | """Test that lower case subsection header is valid even if it has the same name as section kind. -600 | +600 | 601 | Parameters: | ^^^^^^^^^^ D413 602 | ---------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap index c50a27623f..c4cfd3cd33 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D414_sections.py.snap @@ -1,21 +1,20 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- sections.py:56:5: D414 Section has no content ("Returns") | 54 | """Toggle the gizmo. -55 | +55 | 56 | Returns | ^^^^^^^ D414 -57 | +57 | 58 | """ | sections.py:67:5: D414 Section has no content ("Returns") | 65 | """Toggle the gizmo. -66 | +66 | 67 | Returns""" | ^^^^^^^ D414 | @@ -23,7 +22,7 @@ sections.py:67:5: D414 Section has no content ("Returns") sections.py:78:5: D414 Section has no content ("Returns") | 76 | """Toggle the gizmo. -77 | +77 | 78 | Returns | ^^^^^^^ D414 79 | ------- @@ -42,7 +41,7 @@ sections.py:80:5: D414 Section has no content ("Yields") sections.py:172:5: D414 Section has no content ("Returns") | 170 | """Toggle the gizmo. -171 | +171 | 172 | Returns | ^^^^^^^ D414 173 | ------- @@ -52,17 +51,17 @@ sections.py:172:5: D414 Section has no content ("Returns") sections.py:266:5: D414 Section has no content ("Returns") | 264 | note: A random string. -265 | +265 | 266 | Returns: | ^^^^^^^ D414 -267 | +267 | 268 | Raises: | sections.py:563:9: D414 Section has no content ("Returns") | 561 | Here's a note. -562 | +562 | 563 | Returns: | ^^^^^^^ D414 564 | """ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap index ffc17f2005..17d957fa2b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D417_sections.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- sections.py:292:9: D417 Missing argument description in the docstring for `bar`: `y` | 290 | x = 1 -291 | +291 | 292 | def bar(y=2): # noqa: D207, D213, D406, D407 | ^^^ D417 293 | """Nested function test for docstrings. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap index 6775b85826..18f659a0c5 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D419_D.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D.py:20:9: D419 Docstring is empty | 19 | class meta: 20 | """""" | ^^^^^^ D419 -21 | +21 | 22 | @expect('D102: Missing docstring in public method') | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap index 38a96aa54c..4d728dac52 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_google.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D417.py:1:5: D417 Missing argument descriptions in the docstring for `f`: `y`, `z` | @@ -76,7 +75,7 @@ D417.py:155:5: D417 Missing argument description in the docstring for `select_da D417.py:172:5: D417 Missing argument description in the docstring for `f`: `**kwargs` | 170 | """ -171 | +171 | 172 | def f(x, *args, **kwargs): | ^ D417 173 | """Do something. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap index 38a96aa54c..4d728dac52 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D417.py:1:5: D417 Missing argument descriptions in the docstring for `f`: `y`, `z` | @@ -76,7 +75,7 @@ D417.py:155:5: D417 Missing argument description in the docstring for `select_da D417.py:172:5: D417 Missing argument description in the docstring for `f`: `**kwargs` | 170 | """ -171 | +171 | 172 | def f(x, *args, **kwargs): | ^ D417 173 | """Do something. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified_ignore_var_parameters.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified_ignore_var_parameters.snap index 38a96aa54c..4d728dac52 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified_ignore_var_parameters.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d417_unspecified_ignore_var_parameters.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -snapshot_kind: text --- D417.py:1:5: D417 Missing argument descriptions in the docstring for `f`: `y`, `z` | @@ -76,7 +75,7 @@ D417.py:155:5: D417 Missing argument description in the docstring for `select_da D417.py:172:5: D417 Missing argument description in the docstring for `f`: `**kwargs` | 170 | """ -171 | +171 | 172 | def f(x, *args, **kwargs): | ^ D417 173 | """Do something. 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 b77ae8d19f..386a6e2892 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F401_0.py:2:8: F401 [*] `functools` imported but unused | @@ -84,7 +83,7 @@ F401_0.py:33:12: F401 [*] `importlib` imported but unused 32 | import shelve 33 | import importlib | ^^^^^^^^^ F401 -34 | +34 | 35 | if TYPE_CHECKING: | = help: Remove unused import: `importlib` @@ -104,7 +103,7 @@ F401_0.py:37:12: F401 [*] `pathlib` imported but unused 36 | """Hello, world!""" 37 | import pathlib | ^^^^^^^ F401 -38 | +38 | 39 | z = 1 | = help: Remove unused import: `pathlib` @@ -179,7 +178,7 @@ F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused 98 | import foo.bar as bop 99 | import foo.bar.baz | ^^^^^^^^^^^ F401 -100 | +100 | 101 | print(bop.baz.read_csv("test.csv")) | = help: Remove unused import: `foo.bar.baz` @@ -199,7 +198,7 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused 104 | if TYPE_CHECKING: 105 | import a1 | ^^ F401 -106 | +106 | 107 | import a2 | = help: Remove unused import: `a1` @@ -216,7 +215,7 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused F401_0.py:107:12: F401 [*] `a2` imported but unused | 105 | import a1 -106 | +106 | 107 | import a2 | ^^ F401 | @@ -237,7 +236,7 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused 111 | case 0,: 112 | import b1 | ^^ F401 -113 | +113 | 114 | import b2 | = help: Remove unused import: `b1` @@ -254,7 +253,7 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused F401_0.py:114:16: F401 [*] `b2` imported but unused | 112 | import b1 -113 | +113 | 114 | import b2 | ^^ F401 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap index a6748658a1..55ff498a05 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_10.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F401_10.py:6:16: F401 `orjson` imported but unused; consider using `importlib.util.find_spec` to test for availability | @@ -8,7 +7,7 @@ F401_10.py:6:16: F401 `orjson` imported but unused; consider using `importlib.ut 5 | try: 6 | import orjson | ^^^^^^ F401 -7 | +7 | 8 | return True | = help: Remove unused import: `orjson` @@ -19,7 +18,7 @@ F401_10.py:15:16: F401 `orjson` imported but unused; consider using `importlib.u 14 | try: 15 | import orjson | ^^^^^^ F401 -16 | +16 | 17 | return True | = help: Remove unused import: `orjson` 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 7bf797d3cd..24a1dc4ff1 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F401_17.py:12:27: F401 [*] `threading.Thread` imported but unused | 11 | def fn(thread: Thread): 12 | from threading import Thread | ^^^^^^ F401 -13 | +13 | 14 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the | = help: Remove unused import: `threading.Thread` @@ -26,7 +25,7 @@ F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused 19 | def fn(thread: Thread): 20 | from threading import Thread | ^^^^^^ F401 -21 | +21 | 22 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the | = help: Remove unused import: `threading.Thread` 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 84a4897835..24dbe932b4 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F401_6.py:7:25: F401 [*] `.background.BackgroundTasks` imported but unused | 6 | # F401 `background.BackgroundTasks` imported but unused 7 | from .background import BackgroundTasks | ^^^^^^^^^^^^^^^ F401 -8 | +8 | 9 | # F401 `datastructures.UploadFile` imported but unused | = help: Remove unused import: `.background.BackgroundTasks` @@ -26,7 +25,7 @@ F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused 9 | # F401 `datastructures.UploadFile` imported but unused 10 | from .datastructures import UploadFile as FileUpload | ^^^^^^^^^^ F401 -11 | +11 | 12 | # OK | = help: Remove unused import: `.datastructures.UploadFile` @@ -45,7 +44,7 @@ F401_6.py:16:8: F401 [*] `background` imported but unused 15 | # F401 `background` imported but unused 16 | import background | ^^^^^^^^^^ F401 -17 | +17 | 18 | # F401 `datastructures` imported but unused | = help: Remove unused import: `background` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap index 515ca60e48..be576ca11c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- __init__.py:8:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys - 7 | + 7 | 8 | from . import unused, exported, renamed as bees | ^^^^^^ F401 - 9 | + 9 | 10 | if sys.version_info > (3, 9): | = help: Remove unused import @@ -26,10 +25,10 @@ __init__.py:8:15: F401 [*] `.unused` imported but unused; consider removing, add __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys - 7 | + 7 | 8 | from . import unused, exported, renamed as bees | ^^^^ F401 - 9 | + 9 | 10 | if sys.version_info > (3, 9): | = help: Remove unused import diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap index 75c2e0795a..f65dc78b59 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F401_30.py:6:19: F401 [*] `.main.MaμToMan` imported but unused | 4 | """ -5 | +5 | 6 | from .main import MaµToMan | ^^^^^^^^ F401 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap index 324c57b760..57c17bb0c5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_stable_F401_29__all_conditional____init__.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- __init__.py:8:15: F401 `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys - 7 | + 7 | 8 | from . import unused, exported, renamed as bees | ^^^^^^ F401 - 9 | + 9 | 10 | if sys.version_info > (3, 9): | = help: Remove unused import @@ -16,10 +15,10 @@ __init__.py:8:15: F401 `.unused` imported but unused; consider removing, adding __init__.py:8:44: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys - 7 | + 7 | 8 | from . import unused, exported, renamed as bees | ^^^^ F401 - 9 | + 9 | 10 | if sys.version_info > (3, 9): | = help: Remove unused import diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap index cb4dcbad83..b6c04ece22 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F402_F402.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F402.py:5:5: F402 Import `os` from line 1 shadowed by loop variable | @@ -12,7 +11,7 @@ F402.py:5:5: F402 Import `os` from line 1 shadowed by loop variable F402.py:8:5: F402 Import `path` from line 2 shadowed by loop variable | 6 | pass -7 | +7 | 8 | for path in range(3): | ^^^^ F402 9 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap index 6b283ac329..954899e12a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F403_F403.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F403.py:1:1: F403 `from F634 import *` used; unable to detect undefined names | @@ -14,6 +13,6 @@ F403.py:2:1: F403 `from F634 import *` used; unable to detect undefined names 1 | from F634 import * 2 | from F634 import * # noqa: E501 | ^^^^^^^^^^^^^^^^^^ F403 -3 | +3 | 4 | from F634 import * # noqa | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap index 48f04fc13f..0e5776e9b3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_0.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F404_0.py:6:1: F404 `from __future__` imports must occur at the beginning of the file | 4 | from collections import namedtuple -5 | +5 | 6 | from __future__ import print_function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F404 -7 | +7 | 8 | import __future__ | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap index 22dc7a5bab..533b95b9a7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F404_1.py:5:1: F404 `from __future__` imports must occur at the beginning of the file | 3 | """Non-docstring""" -4 | +4 | 5 | from __future__ import absolute_import | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F404 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap index 892e99f850..566ebc15bb 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F405_F405.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F405.py:5:11: F405 `name` may be undefined, or defined from star imports | @@ -12,7 +11,7 @@ F405.py:5:11: F405 `name` may be undefined, or defined from star imports F405.py:11:12: F405 `a` may be undefined, or defined from star imports | 9 | print(name) -10 | +10 | 11 | __all__ = ['a'] | ^^^ F405 | 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 31e02878d3..270e0e25a5 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b | @@ -8,7 +7,7 @@ F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b 2 | a = "wrong" 3 | "%(a)s %(c)s" % {a: "?", "b": "!"} # F504 ("b" not used) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F504 -4 | +4 | 5 | hidden = {"a": "!"} | = help: Remove extra named arguments: b @@ -25,7 +24,7 @@ F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b | 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) -7 | +7 | 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F504 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) @@ -47,7 +46,7 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F504 -10 | +10 | 11 | '' % {'a''b' : ''} # F504 ("ab" not used) | = help: Remove extra named arguments: b @@ -65,10 +64,10 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab | 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) -10 | +10 | 11 | '' % {'a''b' : ''} # F504 ("ab" not used) | ^^^^^^^^^^^^^^^^^^ F504 -12 | +12 | 13 | # https://github.com/astral-sh/ruff/issues/4899 | = help: Remove extra named arguments: ab diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap index bcb4e836dd..8014d22098 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F506_F50x.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F50x.py:2:1: F506 `%`-format string has mixed positional and named placeholders | @@ -27,6 +26,6 @@ F50x.py:11:1: F506 `%`-format string has mixed positional and named placeholders 10 | '%s %s' % {'k': 'v'} # F503 11 | '%(bar)*s' % {'bar': 'baz'} # F506, F508 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ F506 -12 | +12 | 13 | # ok: single %s with mapping | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap index 5689f46313..b441512343 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F508_F50x.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F50x.py:11:1: F508 `%`-format string `*` specifier requires sequence | @@ -8,6 +7,6 @@ F50x.py:11:1: F508 `%`-format string `*` specifier requires sequence 10 | '%s %s' % {'k': 'v'} # F503 11 | '%(bar)*s' % {'bar': 'baz'} # F506, F508 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ F508 -12 | +12 | 13 | # ok: single %s with mapping | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap index 063e654867..c9f840f58a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F521_F521.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F521.py:1:1: F521 `.format` call has invalid format string: Single '{' encountered in format string | @@ -64,6 +63,6 @@ F521.py:9:1: F521 `.format` call has invalid format string: Empty attribute in f 8 | "{foo..}".format(foo=1) 9 | "{foo..bar}".format(foo=1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ F521 -10 | +10 | 11 | # The following are all "good" uses of .format | 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 b072d35ab0..5b882fb4c6 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 @@ -77,7 +77,7 @@ F523.py:7:1: F523 `.format` call has unused arguments at position(s): 0, 3 6 | "{0}{2}".format(1, 2) # F523, # F524 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F523 -8 | +8 | 9 | # With no indexes | = help: Remove extra positional arguments at position(s): 0, 3 @@ -129,7 +129,7 @@ F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 12 | "{:{}}".format(1, 2) # No issues 13 | "{:{}}".format(1, 2, 3) # F523 | ^^^^^^^^^^^^^^^^^^^^^^^ F523 -14 | +14 | 15 | # With *args | = help: Remove extra positional arguments at position(s): 2 @@ -150,7 +150,7 @@ F523.py:19:1: F523 `.format` call has unused arguments at position(s): 2 18 | "{0}{1}".format(1, 2, *args) # No issues 19 | "{0}{1}".format(1, 2, 3, *args) # F523 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F523 -20 | +20 | 21 | # With nested quotes | = help: Remove extra positional arguments at position(s): 2 @@ -201,7 +201,7 @@ F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 23 | "\"\"{1}{0}".format(1, 2, 3) # F523 24 | '""{1}{0}'.format(1, 2, 3) # F523 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ F523 -25 | +25 | 26 | # With modified indexes | = help: Remove extra positional arguments at position(s): 2 @@ -242,7 +242,7 @@ F523.py:29:1: F523 `.format` call has unused arguments at position(s): 0 28 | "{1}{3}".format(1, 2, 3, 4) # F523, # F524 29 | "{1} {8}".format(0, 1) # F523, # F524 | ^^^^^^^^^^^^^^^^^^^^^^ F523 -30 | +30 | 31 | # Multiline | = help: Remove extra positional arguments at position(s): 0 @@ -254,7 +254,7 @@ F523.py:32:2: F523 [*] `.format` call has unused arguments at position(s): 0 | __^ 33 | | .format(2)) | |__________^ F523 -34 | +34 | 35 | # Removing the final argument. | = help: Remove extra positional arguments at position(s): 0 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 cd2143101b..a7938d42ab 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F541.py:6:5: F541 [*] f-string without any placeholders | @@ -154,7 +153,7 @@ F541.py:19:5: F541 [*] f-string without any placeholders 18 | ) 19 | g = f"" | ^^^ F541 -20 | +20 | 21 | # OK | = help: Remove extraneous `f` prefix @@ -174,7 +173,7 @@ F541.py:25:13: F541 [*] f-string without any placeholders 24 | # Error 25 | h = "x" "y" f"z" | ^^^^ F541 -26 | +26 | 27 | v = 23.234234 | = help: Remove extraneous `f` prefix 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 5e9c377de1..b16b7bea64 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F601.py:3:5: F601 Dictionary key literal `"a"` repeated | @@ -246,7 +245,7 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | 47 | } -48 | +48 | 49 | x = {"a": 1, "a": 1} | ^^^ F601 50 | x = {"a": 1, "b": 2, "a": 1} @@ -268,7 +267,7 @@ F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated 49 | x = {"a": 1, "a": 1} 50 | x = {"a": 1, "b": 2, "a": 1} | ^^^ F601 -51 | +51 | 52 | x = { | = help: Remove repeated key literal `"a"` @@ -298,7 +297,7 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 58 | t={"x":"test123", "x":("test123")} | ^^^ F601 -59 | +59 | 60 | t={"x":("test123"), "x":"test123"} | = help: Remove repeated key literal `"x"` @@ -316,10 +315,10 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | 58 | t={"x":"test123", "x":("test123")} -59 | +59 | 60 | t={"x":("test123"), "x":"test123"} | ^^^ F601 -61 | +61 | 62 | # Regression test for: https://github.com/astral-sh/ruff/issues/12772 | = help: Remove repeated key literal `"x"` 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 434d700c8e..6fe76f9fd0 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F602.py:5:5: F602 Dictionary key `a` repeated | @@ -213,7 +212,7 @@ F602.py:41:5: F602 Dictionary key `a` repeated F602.py:44:12: F602 [*] Dictionary key `a` repeated | 42 | } -43 | +43 | 44 | x = {a: 1, a: 1} | ^ F602 45 | x = {a: 1, b: 2, 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 0e34699876..0bf2cf432b 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F632.py:1:4: F632 [*] Use `==` to compare constant literals | @@ -20,7 +19,7 @@ F632.py:1:4: F632 [*] Use `==` to compare constant literals F632.py:4:4: F632 [*] Use `!=` to compare constant literals | 2 | pass -3 | +3 | 4 | if 123 is not y: | ^^^^^^^^^^^^ F632 5 | pass @@ -40,7 +39,7 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals F632.py:7:4: F632 [*] Use `!=` to compare constant literals | 5 | pass -6 | +6 | 7 | if 123 is \ | ____^ 8 | | not y: @@ -63,7 +62,7 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals F632.py:11:4: F632 [*] Use `==` to compare constant literals | 9 | pass -10 | +10 | 11 | if "123" is x < 3: | ^^^^^^^^^^^^^^ F632 12 | pass @@ -83,7 +82,7 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals F632.py:14:4: F632 [*] Use `==` to compare constant literals | 12 | pass -13 | +13 | 14 | if "123" != x is 3: | ^^^^^^^^^^^^^^^ F632 15 | pass @@ -103,7 +102,7 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals F632.py:17:4: F632 [*] Use `==` to compare constant literals | 15 | pass -16 | +16 | 17 | if ("123" != x) is 3: | ^^^^^^^^^^^^^^^^^ F632 18 | pass @@ -123,7 +122,7 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals F632.py:20:14: F632 [*] Use `==` to compare constant literals | 18 | pass -19 | +19 | 20 | if "123" != (x is 3): | ^^^^^^ F632 21 | pass @@ -143,12 +142,12 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals F632.py:23:2: F632 [*] Use `!=` to compare constant literals | 21 | pass -22 | +22 | 23 | {2 is | __^ 24 | | not ''} | |______^ F632 -25 | +25 | 26 | {2 is | = help: Replace `is not` with `!=` @@ -167,12 +166,12 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals F632.py:26:2: F632 [*] Use `!=` to compare constant literals | 24 | not ''} -25 | +25 | 26 | {2 is | __^ 27 | | not ''} | |_______^ F632 -28 | +28 | 29 | # Regression test for | = help: Replace `is not` with `!=` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap index cdd9788299..1399617c01 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F633_F633.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F633.py:4:1: F633 Use of `>>` is invalid with `print` function | 2 | import sys -3 | +3 | 4 | print >> sys.stderr, "Hello" | ^^^^^ F633 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap index 3f9eda1a9c..ce4f4be9aa 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F634_F634.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F634.py:1:4: F634 If test is a tuple, which is always `True` | @@ -12,7 +11,7 @@ F634.py:1:4: F634 If test is a tuple, which is always `True` F634.py:4:4: F634 If test is a tuple, which is always `True` | 2 | pass -3 | +3 | 4 | if (3, 4): | ^^^^^^ F634 5 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap index 23be6d8964..775b955209 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F701_F701.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F701.py:4:5: F701 `break` outside loop | @@ -8,14 +7,14 @@ F701.py:4:5: F701 `break` outside loop 3 | else: 4 | break | ^^^^^ F701 -5 | +5 | 6 | i = 0 | F701.py:16:5: F701 `break` outside loop | 14 | break -15 | +15 | 16 | break | ^^^^^ F701 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap index a656678f6b..89f8fd3cc0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F702_F702.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F702.py:4:5: F702 `continue` not properly in loop | @@ -8,14 +7,14 @@ F702.py:4:5: F702 `continue` not properly in loop 3 | else: 4 | continue | ^^^^^^^^ F702 -5 | +5 | 6 | i = 0 | F702.py:16:5: F702 `continue` not properly in loop | 14 | continue -15 | +15 | 16 | continue | ^^^^^^^^ F702 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap index 15891fcb42..367f5873a0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F811_17.py:6:12: F811 [*] Redefinition of unused `fu` from line 2 | 5 | def bar(): 6 | import fu | ^^ F811 -7 | +7 | 8 | def baz(): | = help: Remove definition: `fu` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap index aff6b40d4d..91cacac98d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_26.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F811_26.py:5:9: F811 Redefinition of unused `func` from line 2 | 3 | pass -4 | +4 | 5 | def func(self): | ^^^^ F811 6 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap index c8d46f2b0f..69b2869a43 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_28.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F811_28.py:4:22: F811 Redefinition of unused `datetime` from line 3 | 3 | import datetime 4 | from datetime import datetime | ^^^^^^^^ F811 -5 | +5 | 6 | datetime(1, 2, 3) | = help: Remove definition: `datetime` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap index dfe89ac980..b67239e5d4 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_29.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F811_29.pyi:8:1: F811 Redefinition of unused `Bar` from line 3 | 6 | Bar: int # OK -7 | +7 | 8 | Bar = 1 # F811 | ^^^ F811 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap index 68319f4244..b2955d6075 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_30.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F811_30.py:12:9: F811 Redefinition of unused `bar` from line 10 | 10 | bar = foo -11 | +11 | 12 | def bar(self) -> None: | ^^^ F811 13 | """Bar.""" @@ -15,7 +14,7 @@ F811_30.py:12:9: F811 Redefinition of unused `bar` from line 10 F811_30.py:21:5: F811 Redefinition of unused `baz` from line 18 | 19 | """Baz.""" -20 | +20 | 21 | baz = 1 | ^^^ F811 | @@ -24,7 +23,7 @@ F811_30.py:21:5: F811 Redefinition of unused `baz` from line 18 F811_30.py:29:12: F811 Redefinition of unused `foo` from line 26 | 27 | """Foo.""" -28 | +28 | 29 | bar = (foo := 1) | ^^^ F811 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap index 439eae473a..bb4eb97b10 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_31.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F811_31.py:19:29: F811 Redefinition of unused `baz` from line 17 | 17 | baz = None -18 | +18 | 19 | from some_module import baz | ^^^ F811 20 | except ImportError: diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap index 791754ebbf..ad83ffe0ac 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_0.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_0.py:2:12: F821 Undefined name `self` | @@ -33,10 +32,10 @@ F821_0.py:21:12: F821 Undefined name `numeric_string` F821_0.py:58:5: F821 Undefined name `Bar` | 56 | y: int = 1 -57 | +57 | 58 | x: "Bar" = 1 | ^^^ F821 -59 | +59 | 60 | [first] = ["yup"] | @@ -81,7 +80,7 @@ F821_0.py:93:14: F821 Undefined name `B` 92 | C = f'{A:{B}}' 93 | C = f'{A:{f"{B}"}}' | ^ F821 -94 | +94 | 95 | from typing import Annotated, Literal | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap index 6ad86a5472..d156dc3ea9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_13.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_13.py:8:19: F821 Undefined name `List` | 6 | Y: ForwardRef("List[int]") -7 | +7 | 8 | Z = TypeVar("X", "List[int]", "int") | ^^^^ F821 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap index 4c3d9aa3dd..643cc2a4cb 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_2.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_2.py:5:13: F821 Undefined name `Model` | 4 | # F821 Undefined name `Model` 5 | x: Literal["Model"] | ^^^^^ F821 -6 | +6 | 7 | from typing_extensions import Literal | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap index 1a48677167..f791abbfcc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_20.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_20.py:3:24: F821 Undefined name `Record` | 1 | """Test lazy evaluation of type alias values.""" -2 | +2 | 3 | type RecordCallback[R: Record] = Callable[[R], None] | ^^^^^^ F821 -4 | +4 | 5 | from collections.abc import Callable | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap index ff7ec8cad0..56103d85ad 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_28.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_28.py:9:7: F821 Undefined name `𝒟` | 7 | print(C == 𝑪 == 𝒞 == 𝓒 == 𝕮) -8 | +8 | 9 | print(𝒟) # F821 | ^ F821 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap index ebe035fe9e..2f06a91e4c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_3.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_3.py:11:10: F821 Undefined name `key` | @@ -8,7 +7,7 @@ F821_3.py:11:10: F821 Undefined name `key` 10 | # F821 Undefined name `value` 11 | x: dict["key", "value"] | ^^^ F821 -12 | +12 | 13 | # OK | @@ -18,6 +17,6 @@ F821_3.py:11:17: F821 Undefined name `value` 10 | # F821 Undefined name `value` 11 | x: dict["key", "value"] | ^^^^^ F821 -12 | +12 | 13 | # OK | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap index de202b8c91..9077bbc312 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_4.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F821_4.py:4:11: F821 Undefined name `Model` | 2 | from typing import List -3 | +3 | 4 | _ = List["Model"] | ^^^^^ F821 | @@ -13,7 +12,7 @@ F821_4.py:4:11: F821 Undefined name `Model` F821_4.py:9:12: F821 Undefined name `Model` | 7 | from typing import List as IList -8 | +8 | 9 | _ = IList["Model"] | ^^^^^ F821 | @@ -21,7 +20,7 @@ F821_4.py:9:12: F821 Undefined name `Model` F821_4.py:14:16: F821 Undefined name `Model` | 12 | from collections.abc import ItemsView -13 | +13 | 14 | _ = ItemsView["Model"] | ^^^^^ F821 | @@ -29,7 +28,7 @@ F821_4.py:14:16: F821 Undefined name `Model` F821_4.py:19:32: F821 Undefined name `Model` | 17 | import collections.abc -18 | +18 | 19 | _ = collections.abc.ItemsView["Model"] | ^^^^^ F821 | @@ -37,7 +36,7 @@ F821_4.py:19:32: F821 Undefined name `Model` F821_4.py:24:20: F821 Undefined name `Model` | 22 | from collections import abc -23 | +23 | 24 | _ = abc.ItemsView["Model"] | ^^^^^ F821 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap index b0dd404f15..10d1e6f4e0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F822_0.py:3:17: F822 Undefined name `b` in `__all__` | 1 | a = 1 -2 | +2 | 3 | __all__ = ["a", "b"] | ^^^ F822 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap index cac8528176..4810ad4608 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_0.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F822_0.pyi:4:22: F822 Undefined name `c` in `__all__` | 2 | b: int # Considered a binding in a `.pyi` stub file, not in a `.py` runtime file -3 | +3 | 4 | __all__ = ["a", "b", "c"] # c is flagged as missing; b is not | ^^^ F822 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap index f74f19c9e9..5486326ac9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F822_1.py:3:22: F822 Undefined name `b` in `__all__` | 1 | a = 1 -2 | +2 | 3 | __all__ = list(["a", "b"]) | ^^^ F822 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap index 61789a4154..a52632a6a8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_1b.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F822_1b.py:4:31: F822 Undefined name `b` in `__all__` | 2 | a = 1 -3 | +3 | 4 | __all__ = builtins.list(["a", "b"]) | ^^^ F822 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap index ec266a2f4e..75fd12222a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F823_F823.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F823.py:6:5: F823 Local variable `my_var` referenced before assignment | @@ -31,7 +30,7 @@ F823.py:48:11: F823 Local variable `sys` referenced before assignment 47 | def main(): 48 | print(sys.argv) | ^^^ F823 -49 | +49 | 50 | try: | @@ -40,6 +39,6 @@ F823.py:62:11: F823 Local variable `sys` referenced before assignment 61 | def main(): 62 | print(sys.argv) | ^^^ F823 -63 | +63 | 64 | for sys in range(5): | 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 b1912dc837..a8a860e83c 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used | @@ -64,7 +63,7 @@ F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used 20 | foo = (1, 2) 21 | (a, b) = (1, 2) | ^ F841 -22 | +22 | 23 | bar = (1, 2) | = help: Remove assignment to unused variable `a` @@ -85,7 +84,7 @@ F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used 20 | foo = (1, 2) 21 | (a, b) = (1, 2) | ^ F841 -22 | +22 | 23 | bar = (1, 2) | = help: Remove assignment to unused variable `b` @@ -103,7 +102,7 @@ F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar -25 | +25 | 26 | (x, y) = baz = bar | ^^^ F841 | @@ -125,7 +124,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used 50 | # F841 51 | b = 1 | ^ F841 -52 | +52 | 53 | def d(): | = help: Remove assignment to unused variable `b` @@ -206,7 +205,7 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used 114 | Bar = enum.Enum("Bar", "A B") 115 | Baz = enum.Enum("Baz", "A B") | ^^^ F841 -116 | +116 | 117 | match x: | = help: Remove assignment to unused variable `Baz` 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 b2578711db..c3250b8451 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used | @@ -26,7 +25,7 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used 5 | x = 1 6 | y = 2 | ^ F841 -7 | +7 | 8 | z = 3 | = help: Remove assignment to unused variable `y` @@ -64,7 +63,7 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used 13 | x: int = 1 14 | y: int = 2 | ^ F841 -15 | +15 | 16 | z: int = 3 | = help: Remove assignment to unused variable `y` @@ -100,7 +99,7 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | 25 | pass -26 | +26 | 27 | with (foo() as x3, foo() as y3, foo() as z3): | ^^ F841 28 | pass @@ -120,7 +119,7 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | 25 | pass -26 | +26 | 27 | with (foo() as x3, foo() as y3, foo() as z3): | ^^ F841 28 | pass @@ -140,7 +139,7 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | 25 | pass -26 | +26 | 27 | with (foo() as x3, foo() as y3, foo() as z3): | ^^ F841 28 | pass @@ -299,7 +298,7 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | 54 | ) -55 | +55 | 56 | y = \ | ^ F841 57 | a() if a is not None else b @@ -343,7 +342,7 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | 65 | ) -66 | +66 | 67 | y = \ | ^ F841 68 | a if a is not None else b @@ -666,7 +665,7 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used 164 | def f(): 165 | x = 1 | ^ F841 -166 | +166 | 167 | y = 2 | = help: Remove assignment to unused variable `x` @@ -683,7 +682,7 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | 165 | x = 1 -166 | +166 | 167 | y = 2 | ^ F841 | 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 fb9a268806..9d08e6b818 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- :5:12: F401 [*] `os` imported but unused | 4 | def f(): 5 | import os | ^^ F401 -6 | +6 | 7 | # Despite this `del`, `import os` in `f` should still be flagged as shadowing an unused | = help: Remove unused import: `os` 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 2a0b90409d..f2a3fb29b2 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- :2:8: F401 [*] `os` imported but unused | 2 | import os | ^^ F401 -3 | +3 | 4 | def f(): | = help: Remove unused import: `os` @@ -23,7 +22,7 @@ snapshot_kind: text 4 | def f(): 5 | import os | ^^ F811 -6 | +6 | 7 | # Despite this `del`, `import os` in `f` should still be flagged as shadowing an unused | = help: Remove definition: `os` 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 3fed708c09..38f194e157 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- :2:8: F401 [*] `os` imported but unused | 2 | import os | ^^ F401 -3 | +3 | 4 | def f(): | = help: Remove unused import: `os` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap index c9f4a87d31..2177b874a1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- :4:12: F811 [*] Redefinition of unused `os` from line 3 | @@ -8,7 +7,7 @@ snapshot_kind: text 3 | import os 4 | import os | ^^ F811 -5 | +5 | 6 | # Despite this `del`, `import os` should still be flagged as shadowing an unused | = help: Remove definition: `os` 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 169b059e4c..c87dbb04b6 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used | @@ -45,7 +44,7 @@ F841_0.py:21:6: F841 Local variable `a` is assigned to but never used 20 | foo = (1, 2) 21 | (a, b) = (1, 2) | ^ F841 -22 | +22 | 23 | bar = (1, 2) | = help: Remove assignment to unused variable `a` @@ -56,7 +55,7 @@ F841_0.py:21:9: F841 Local variable `b` is assigned to but never used 20 | foo = (1, 2) 21 | (a, b) = (1, 2) | ^ F841 -22 | +22 | 23 | bar = (1, 2) | = help: Remove assignment to unused variable `b` @@ -64,7 +63,7 @@ F841_0.py:21:9: F841 Local variable `b` is assigned to but never used F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar -25 | +25 | 26 | (x, y) = baz = bar | ^^^ F841 | @@ -142,7 +141,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used 50 | # F841 51 | b = 1 | ^ F841 -52 | +52 | 53 | def d(): | = help: Remove assignment to unused variable `b` @@ -223,7 +222,7 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used 114 | Bar = enum.Enum("Bar", "A B") 115 | Baz = enum.Enum("Baz", "A B") | ^^^ F841 -116 | +116 | 117 | match x: | = help: Remove assignment to unused variable `Baz` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap index 63a557b09f..4153aa879f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__init.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- __init__.py:1:8: F401 `os` imported but unused | 1 | import os | ^^ F401 -2 | +2 | 3 | print(__path__) | = help: Remove unused import: `os` 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 dadea91163..2a79871a80 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- multi_statement_lines.py:2:12: F401 [*] `foo1` imported but unused | @@ -25,7 +24,7 @@ multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused 2 | import foo1; x = 1 3 | import foo2; x = 1 | ^^^^ F401 -4 | +4 | 5 | if True: | = help: Remove unused import: `foo2` @@ -103,7 +102,7 @@ multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused 18 | x = 1; \ 19 | import foo6 | ^^^^ F401 -20 | +20 | 21 | if True: | = help: Remove unused import: `foo6` @@ -125,7 +124,7 @@ multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused 22 | x = 1 \ 23 | ; import foo7 | ^^^^ F401 -24 | +24 | 25 | if True: | = help: Remove unused import: `foo7` @@ -165,7 +164,7 @@ multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused 26 | x = 1; import foo8; x = 1 27 | x = 1; import foo9; x = 1 | ^^^^ F401 -28 | +28 | 29 | if True: | = help: Remove unused import: `foo9` @@ -226,7 +225,7 @@ multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused 41 | \ 42 | import foo12 | ^^^^^ F401 -43 | +43 | 44 | if True: | = help: Remove unused import: `foo12` @@ -270,7 +269,7 @@ multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused 52 | # \ 53 | import foo14 | ^^^^^ F401 -54 | +54 | 55 | # Continuation, but not as the last content in the file. | = help: Remove unused import: `foo14` @@ -290,7 +289,7 @@ multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused 56 | x = 1; \ 57 | import foo15 | ^^^^^ F401 -58 | +58 | 59 | # Continuation, followed by end-of-file. (Removing `import foo` would cause a syntax | = help: Remove unused import: `foo15` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap index 324c57b760..57c17bb0c5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_29__all_conditional____init__.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- __init__.py:8:15: F401 `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys - 7 | + 7 | 8 | from . import unused, exported, renamed as bees | ^^^^^^ F401 - 9 | + 9 | 10 | if sys.version_info > (3, 9): | = help: Remove unused import @@ -16,10 +15,10 @@ __init__.py:8:15: F401 `.unused` imported but unused; consider removing, adding __init__.py:8:44: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys - 7 | + 7 | 8 | from . import unused, exported, renamed as bees | ^^^^ F401 - 9 | + 9 | 10 | if sys.version_info > (3, 9): | = help: Remove unused import diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap index fe351ac158..a6ec69a4a5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- __init__.py:1:8: F401 [*] `os` imported but unused | 1 | import os | ^^ F401 -2 | +2 | 3 | print(__path__) | = help: Remove unused import: `os` diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap index 00bb37925f..40b04dfafd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F822___init__.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs -snapshot_kind: text --- __init__.py:5:12: F822 Undefined name `a` in `__all__` | 3 | print(__path__) -4 | +4 | 5 | __all__ = ["a", "b", "c"] | ^^^ F822 | @@ -13,7 +12,7 @@ __init__.py:5:12: F822 Undefined name `a` in `__all__` __init__.py:5:17: F822 Undefined name `b` in `__all__` | 3 | print(__path__) -4 | +4 | 5 | __all__ = ["a", "b", "c"] | ^^^ F822 | @@ -21,7 +20,7 @@ __init__.py:5:17: F822 Undefined name `b` in `__all__` __init__.py:5:22: F822 Undefined name `c` in `__all__` | 3 | print(__path__) -4 | +4 | 5 | __all__ = ["a", "b", "c"] | ^^^ F822 | diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap index a1a8c5e228..20b023cd3d 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_0.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs -snapshot_kind: text --- PGH003_0.py:1:8: PGH003 Use specific rule codes when ignoring type issues | @@ -34,6 +33,6 @@ PGH003_0.py:4:25: PGH003 Use specific rule codes when ignoring type issues 3 | x = 1 # type: ignore[attr-defined] # type: ignore 4 | x = 1 # type: ignoreme # type: ignore | ^^^^^^^^^^^^^^ PGH003 -5 | +5 | 6 | x = 1 | diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap index 7190703915..3050506086 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH003_PGH003_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs -snapshot_kind: text --- PGH003_1.py:1:8: PGH003 Use specific rule codes when ignoring type issues | @@ -24,6 +23,6 @@ PGH003_1.py:3:41: PGH003 Use specific rule codes when ignoring type issues 2 | x = 1 # pyright:ignore 3 | x = 1 # pyright: ignore[attr-defined] # pyright: ignore | ^^^^^^^^^^^^^^^^^ PGH003 -4 | +4 | 5 | x = 1 | diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap index d55e64c88e..d53e1ef7fa 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs -snapshot_kind: text --- PGH004_0.py:1:8: PGH004 Use specific rule codes when using `noqa` | @@ -35,7 +34,7 @@ PGH004_0.py:18:8: PGH004 [*] Use a colon when specifying `noqa` rule codes 17 | # PGH004 18 | x = 2 # noqa X100 | ^^^^^^^ PGH004 -19 | +19 | 20 | # PGH004 | = help: Add missing colon @@ -55,7 +54,7 @@ PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes 20 | # PGH004 21 | x = 2 # noqa X100, X200 | ^^^^^^^ PGH004 -22 | +22 | 23 | # PGH004 | = help: Add missing colon @@ -75,7 +74,7 @@ PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon 23 | # PGH004 24 | x = 2 # noqa : X300 | ^^^^^^^ PGH004 -25 | +25 | 26 | # PGH004 | = help: Remove space(s) before colon @@ -95,7 +94,7 @@ PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon 26 | # PGH004 27 | x = 2 # noqa : X400 | ^^^^^^^^ PGH004 -28 | +28 | 29 | # PGH004 | = help: Remove space(s) before colon diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap index 076a8fdd9c..1d8c3f41ff 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH005_PGH005_0.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs -snapshot_kind: text --- PGH005_0.py:2:8: PGH005 Non-existent mock method: `not_called` | @@ -86,6 +85,6 @@ PGH005_0.py:10:1: PGH005 Mock method should be called: `assert_called_once_with` 9 | my_mock.assert_called_once_with 10 | MyMock.assert_called_once_with | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PGH005 -11 | +11 | 12 | # OK | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap index 149abfc95f..c83f17fe22 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0105_type_name_incorrect_variance.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- type_name_incorrect_variance.py:5:5: PLC0105 `TypeVar` name "T" does not reflect its covariance; consider renaming it to "T_co" | 3 | # Errors. -4 | +4 | 5 | T = TypeVar("T", covariant=True) | ^^^^^^^ PLC0105 6 | T = TypeVar("T", covariant=True, contravariant=False) @@ -76,14 +75,14 @@ type_name_incorrect_variance.py:12:5: PLC0105 `ParamSpec` name "P" does not refl 11 | P = ParamSpec("P", contravariant=True) 12 | P = ParamSpec("P", covariant=False, contravariant=True) | ^^^^^^^^^ PLC0105 -13 | +13 | 14 | T_co = TypeVar("T_co") | type_name_incorrect_variance.py:14:8: PLC0105 `TypeVar` name "T_co" does not reflect its invariance; consider renaming it to "T" | 12 | P = ParamSpec("P", covariant=False, contravariant=True) -13 | +13 | 14 | T_co = TypeVar("T_co") | ^^^^^^^ PLC0105 15 | T_co = TypeVar("T_co", covariant=False) @@ -194,14 +193,14 @@ type_name_incorrect_variance.py:25:8: PLC0105 `ParamSpec` name "P_co" does not r 24 | P_co = ParamSpec("P_co", contravariant=True) 25 | P_co = ParamSpec("P_co", covariant=False, contravariant=True) | ^^^^^^^^^ PLC0105 -26 | +26 | 27 | T_contra = TypeVar("T_contra") | type_name_incorrect_variance.py:27:12: PLC0105 `TypeVar` name "T_contra" does not reflect its invariance; consider renaming it to "T" | 25 | P_co = ParamSpec("P_co", covariant=False, contravariant=True) -26 | +26 | 27 | T_contra = TypeVar("T_contra") | ^^^^^^^ PLC0105 28 | T_contra = TypeVar("T_contra", covariant=False) @@ -312,6 +311,6 @@ type_name_incorrect_variance.py:38:12: PLC0105 `ParamSpec` name "P_contra" does 37 | P_contra = ParamSpec("P_contra", covariant=True) 38 | P_contra = ParamSpec("P_contra", covariant=True, contravariant=False) | ^^^^^^^^^ PLC0105 -39 | +39 | 40 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap index 7fc2130223..f639f50c42 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0131_type_bivariance.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- type_bivariance.py:5:5: PLC0131 `TypeVar` "T" cannot be both covariant and contravariant | 3 | # Errors. -4 | +4 | 5 | T = TypeVar("T", covariant=True, contravariant=True) | ^^^^^^^ PLC0131 6 | T = TypeVar(name="T", covariant=True, contravariant=True) @@ -16,14 +15,14 @@ type_bivariance.py:6:5: PLC0131 `TypeVar` "T" cannot be both covariant and contr 5 | T = TypeVar("T", covariant=True, contravariant=True) 6 | T = TypeVar(name="T", covariant=True, contravariant=True) | ^^^^^^^ PLC0131 -7 | +7 | 8 | T = ParamSpec("T", covariant=True, contravariant=True) | type_bivariance.py:8:5: PLC0131 `ParamSpec` "T" cannot be both covariant and contravariant | 6 | T = TypeVar(name="T", covariant=True, contravariant=True) -7 | +7 | 8 | T = ParamSpec("T", covariant=True, contravariant=True) | ^^^^^^^^^ PLC0131 9 | T = ParamSpec(name="T", covariant=True, contravariant=True) @@ -34,6 +33,6 @@ type_bivariance.py:9:5: PLC0131 `ParamSpec` "T" cannot be both covariant and con 8 | T = ParamSpec("T", covariant=True, contravariant=True) 9 | T = ParamSpec(name="T", covariant=True, contravariant=True) | ^^^^^^^^^ PLC0131 -10 | +10 | 11 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap index 52a93fc53b..f2d9025bfe 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0132_type_param_name_mismatch.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- type_param_name_mismatch.py:5:5: PLC0132 `TypeVar` name `T` does not match assigned variable name `X` | 3 | # Errors. -4 | +4 | 5 | X = TypeVar("T") | ^^^^^^^^^^^^ PLC0132 6 | X = TypeVar(name="T") @@ -16,14 +15,14 @@ type_param_name_mismatch.py:6:5: PLC0132 `TypeVar` name `T` does not match assig 5 | X = TypeVar("T") 6 | X = TypeVar(name="T") | ^^^^^^^^^^^^^^^^^ PLC0132 -7 | +7 | 8 | Y = ParamSpec("T") | type_param_name_mismatch.py:8:5: PLC0132 `ParamSpec` name `T` does not match assigned variable name `Y` | 6 | X = TypeVar(name="T") -7 | +7 | 8 | Y = ParamSpec("T") | ^^^^^^^^^^^^^^ PLC0132 9 | Y = ParamSpec(name="T") @@ -34,14 +33,14 @@ type_param_name_mismatch.py:9:5: PLC0132 `ParamSpec` name `T` does not match ass 8 | Y = ParamSpec("T") 9 | Y = ParamSpec(name="T") | ^^^^^^^^^^^^^^^^^^^ PLC0132 -10 | +10 | 11 | Z = NewType("T", int) | type_param_name_mismatch.py:11:5: PLC0132 `NewType` name `T` does not match assigned variable name `Z` | 9 | Y = ParamSpec(name="T") -10 | +10 | 11 | Z = NewType("T", int) | ^^^^^^^^^^^^^^^^^ PLC0132 12 | Z = NewType(name="T", tp=int) @@ -52,14 +51,14 @@ type_param_name_mismatch.py:12:5: PLC0132 `NewType` name `T` does not match assi 11 | Z = NewType("T", int) 12 | Z = NewType(name="T", tp=int) | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLC0132 -13 | +13 | 14 | Ws = TypeVarTuple("Ts") | type_param_name_mismatch.py:14:6: PLC0132 `TypeVarTuple` name `Ts` does not match assigned variable name `Ws` | 12 | Z = NewType(name="T", tp=int) -13 | +13 | 14 | Ws = TypeVarTuple("Ts") | ^^^^^^^^^^^^^^^^^^ PLC0132 15 | Ws = TypeVarTuple(name="Ts") @@ -70,6 +69,6 @@ type_param_name_mismatch.py:15:6: PLC0132 `TypeVarTuple` name `Ts` does not matc 14 | Ws = TypeVarTuple("Ts") 15 | Ws = TypeVarTuple(name="Ts") | ^^^^^^^^^^^^^^^^^^^^^^^ PLC0132 -16 | +16 | 17 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap index f37362e3f4..eeb9f628e5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0205_single_string_slots.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- single_string_slots.py:3:5: PLC0205 Class `__slots__` should be a non-string iterable | @@ -8,7 +7,7 @@ single_string_slots.py:3:5: PLC0205 Class `__slots__` should be a non-string ite 2 | class Foo: 3 | __slots__ = "bar" | ^^^^^^^^^^^^^^^^^ PLC0205 -4 | +4 | 5 | def __init__(self, bar): | @@ -17,7 +16,7 @@ single_string_slots.py:10:5: PLC0205 Class `__slots__` should be a non-string it 9 | class Foo: 10 | __slots__: str = "bar" | ^^^^^^^^^^^^^^^^^^^^^^ PLC0205 -11 | +11 | 12 | def __init__(self, bar): | @@ -26,6 +25,6 @@ single_string_slots.py:17:5: PLC0205 Class `__slots__` should be a non-string it 16 | class Foo: 17 | __slots__: str = f"bar" | ^^^^^^^^^^^^^^^^^^^^^^^ PLC0205 -18 | +18 | 19 | def __init__(self, bar): | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap index 3efd122617..a2f87d2e5d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0206_dict_index_missing_items.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- dict_index_missing_items.py:9:1: PLC0206 Extracting value from dictionary without calling `.items()` | @@ -8,61 +7,61 @@ dict_index_missing_items.py:9:1: PLC0206 Extracting value from dictionary withou 9 | / for instrument in ORCHESTRA: 10 | | print(f"{instrument}: {ORCHESTRA[instrument]}") | |___________________________________________________^ PLC0206 -11 | +11 | 12 | for instrument in ORCHESTRA: | dict_index_missing_items.py:12:1: PLC0206 Extracting value from dictionary without calling `.items()` | 10 | print(f"{instrument}: {ORCHESTRA[instrument]}") -11 | +11 | 12 | / for instrument in ORCHESTRA: 13 | | ORCHESTRA[instrument] | |_________________________^ PLC0206 -14 | +14 | 15 | for instrument in ORCHESTRA.keys(): | dict_index_missing_items.py:15:1: PLC0206 Extracting value from dictionary without calling `.items()` | 13 | ORCHESTRA[instrument] -14 | +14 | 15 | / for instrument in ORCHESTRA.keys(): 16 | | print(f"{instrument}: {ORCHESTRA[instrument]}") | |___________________________________________________^ PLC0206 -17 | +17 | 18 | for instrument in ORCHESTRA.keys(): | dict_index_missing_items.py:18:1: PLC0206 Extracting value from dictionary without calling `.items()` | 16 | print(f"{instrument}: {ORCHESTRA[instrument]}") -17 | +17 | 18 | / for instrument in ORCHESTRA.keys(): 19 | | ORCHESTRA[instrument] | |_________________________^ PLC0206 -20 | +20 | 21 | for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): | dict_index_missing_items.py:21:1: PLC0206 Extracting value from dictionary without calling `.items()` | 19 | ORCHESTRA[instrument] -20 | +20 | 21 | / for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): 22 | | print(f"{instrument}: {temp_orchestra[instrument]}") | |________________________________________________________^ PLC0206 -23 | +23 | 24 | for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): | dict_index_missing_items.py:24:1: PLC0206 Extracting value from dictionary without calling `.items()` | 22 | print(f"{instrument}: {temp_orchestra[instrument]}") -23 | +23 | 24 | / for instrument in (temp_orchestra := {"violin": "strings", "oboe": "woodwind"}): 25 | | temp_orchestra[instrument] | |______________________________^ PLC0206 -26 | +26 | 27 | # # OK | 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 435a6a91e5..952670e665 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- iteration_over_set.py:3:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 1 | # Errors -2 | +2 | 3 | for item in {1}: | ^^^ PLC0208 4 | print(f"I can count to {item}!") @@ -24,7 +23,7 @@ iteration_over_set.py:3:13: PLC0208 [*] Use a sequence type instead of a `set` w iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 4 | print(f"I can count to {item}!") -5 | +5 | 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLC0208 7 | print(f"I like {item}.") @@ -44,7 +43,7 @@ iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` w iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 7 | print(f"I like {item}.") - 8 | + 8 | 9 | for item in {1,}: | ^^^^ PLC0208 10 | print(f"I can count to {item}!") @@ -64,7 +63,7 @@ iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` w iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 10 | print(f"I can count to {item}!") -11 | +11 | 12 | for item in { | _____________^ 13 | | "apples", "lemons", "water" @@ -90,10 +89,10 @@ iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 15 | print(f"I like {item}.") -16 | +16 | 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions | ^^^^^^^^^ PLC0208 -18 | +18 | 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions | = help: Convert to `tuple` @@ -111,10 +110,10 @@ iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions -18 | +18 | 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions | ^^^^^^^^^ PLC0208 -20 | +20 | 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions | = help: Convert to `tuple` @@ -132,10 +131,10 @@ iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions -20 | +20 | 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions | ^^^^^^^^^ PLC0208 -22 | +22 | 23 | numbers_gen = (i for i in {1, 2, 3}) # flags sets in generator expressions | = help: Convert to `tuple` @@ -153,10 +152,10 @@ iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions -22 | +22 | 23 | numbers_gen = (i for i in {1, 2, 3}) # flags sets in generator expressions | ^^^^^^^^^ PLC0208 -24 | +24 | 25 | # Non-errors | = help: Convert to `tuple` 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 034b44cbae..483c266aa6 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original package | 4 | # 2. consider-using-from-import -5 | +5 | 6 | import collections as collections # [useless-import-alias] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PLC0414 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap index 3e7f1185f7..36490ce904 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0415_import_outside_top_level.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- import_outside_top_level.py:10:5: PLC0415 `import` should be at the top-level of a file | @@ -63,7 +62,7 @@ import_outside_top_level.py:19:5: PLC0415 `import` should be at the top-level of 18 | class ClassWithImports: 19 | import tokenize # [import-outside-toplevel] | ^^^^^^^^^^^^^^^ PLC0415 -20 | +20 | 21 | def __init__(self): | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1802_len_as_condition.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1802_len_as_condition.py.snap index b39fedc66b..2b64669ae4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1802_len_as_condition.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1802_len_as_condition.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- len_as_condition.py:1:4: PLC1802 [*] `len('TEST')` used as condition without comparison | @@ -20,7 +19,7 @@ len_as_condition.py:1:4: PLC1802 [*] `len('TEST')` used as condition without com len_as_condition.py:4:8: PLC1802 [*] `len('TEST')` used as condition without comparison | 2 | pass -3 | +3 | 4 | if not len('TEST'): # [PLC1802] | ^^^^^^^^^^^ PLC1802 5 | pass @@ -59,7 +58,7 @@ len_as_condition.py:8:10: PLC1802 [*] `len(['T', 'E', 'S', 'T'])` used as condit len_as_condition.py:11:12: PLC1802 [*] `len('TEST')` used as condition without comparison | 9 | pass -10 | +10 | 11 | if True or len('TEST'): # [PLC1802] | ^^^^^^^^^^^ PLC1802 12 | pass @@ -119,7 +118,7 @@ len_as_condition.py:58:10: PLC1802 [*] `len('TEST')` used as condition without c len_as_condition.py:61:7: PLC1802 [*] `len('TEST')` used as condition without comparison | 59 | pass -60 | +60 | 61 | while len('TEST'): # [PLC1802] | ^^^^^^^^^^^ PLC1802 62 | pass @@ -139,7 +138,7 @@ len_as_condition.py:61:7: PLC1802 [*] `len('TEST')` used as condition without co len_as_condition.py:64:11: PLC1802 [*] `len('TEST')` used as condition without comparison | 62 | pass -63 | +63 | 64 | while not len('TEST'): # [PLC1802] | ^^^^^^^^^^^ PLC1802 65 | pass @@ -159,7 +158,7 @@ len_as_condition.py:64:11: PLC1802 [*] `len('TEST')` used as condition without c len_as_condition.py:67:13: PLC1802 [*] `len('TEST')` used as condition without comparison | 65 | pass -66 | +66 | 67 | while z and len('TEST'): # [PLC1802] | ^^^^^^^^^^^ PLC1802 68 | pass @@ -179,7 +178,7 @@ len_as_condition.py:67:13: PLC1802 [*] `len('TEST')` used as condition without c len_as_condition.py:70:11: PLC1802 [*] `len('TEST')` used as condition without comparison | 68 | pass -69 | +69 | 70 | while not len('TEST') and z: # [PLC1802] | ^^^^^^^^^^^ PLC1802 71 | pass @@ -201,7 +200,7 @@ len_as_condition.py:93:12: PLC1802 [*] `len(args)` used as condition without com 92 | def github_issue_1331_v2(*args): 93 | assert len(args), args # [PLC1802] | ^^^^^^^^^ PLC1802 -94 | +94 | 95 | def github_issue_1331_v3(*args): | = help: Remove `len` @@ -221,7 +220,7 @@ len_as_condition.py:96:12: PLC1802 [*] `len(args)` used as condition without com 95 | def github_issue_1331_v3(*args): 96 | assert len(args) or z, args # [PLC1802] | ^^^^^^^^^ PLC1802 -97 | +97 | 98 | def github_issue_1331_v4(*args): | = help: Remove `len` @@ -241,7 +240,7 @@ len_as_condition.py:99:18: PLC1802 [*] `len(args)` used as condition without com 98 | def github_issue_1331_v4(*args): 99 | assert z and len(args), args # [PLC1802] | ^^^^^^^^^ PLC1802 -100 | +100 | 101 | def github_issue_1331_v5(**args): | = help: Remove `len` @@ -261,7 +260,7 @@ len_as_condition.py:102:18: PLC1802 [*] `len(args)` used as condition without co 101 | def github_issue_1331_v5(**args): 102 | assert z and len(args), args # [PLC1802] | ^^^^^^^^^ PLC1802 -103 | +103 | 104 | b = bool(len(z)) # [PLC1802] | = help: Remove `len` @@ -279,7 +278,7 @@ len_as_condition.py:102:18: PLC1802 [*] `len(args)` used as condition without co len_as_condition.py:104:10: PLC1802 [*] `len(z)` used as condition without comparison | 102 | assert z and len(args), args # [PLC1802] -103 | +103 | 104 | b = bool(len(z)) # [PLC1802] | ^^^^^^ PLC1802 105 | c = bool(len('TEST') or 42) # [PLC1802] @@ -301,7 +300,7 @@ len_as_condition.py:105:10: PLC1802 [*] `len('TEST')` used as condition without 104 | b = bool(len(z)) # [PLC1802] 105 | c = bool(len('TEST') or 42) # [PLC1802] | ^^^^^^^^^^^ PLC1802 -106 | +106 | 107 | def github_issue_1879(): | = help: Remove `len` diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap index 3c06a3e518..fefbd85ebc 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC1901_compare_to_empty_string.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- compare_to_empty_string.py:7:13: PLC1901 `x is ""` can be simplified to `not x` as an empty string is falsey | @@ -21,7 +20,7 @@ compare_to_empty_string.py:7:24: PLC1901 `x == ""` can be simplified to `not x` compare_to_empty_string.py:10:17: PLC1901 `y is not ""` can be simplified to `y` as an empty string is falsey | 8 | print("x is an empty string") - 9 | + 9 | 10 | if y is not "" or y != "": | ^^ PLC1901 11 | print("y is not an empty string") @@ -30,7 +29,7 @@ compare_to_empty_string.py:10:17: PLC1901 `y is not ""` can be simplified to `y` compare_to_empty_string.py:10:28: PLC1901 `y != ""` can be simplified to `y` as an empty string is falsey | 8 | print("x is an empty string") - 9 | + 9 | 10 | if y is not "" or y != "": | ^^ PLC1901 11 | print("y is not an empty string") @@ -39,7 +38,7 @@ compare_to_empty_string.py:10:28: PLC1901 `y != ""` can be simplified to `y` as compare_to_empty_string.py:13:8: PLC1901 `"" != z` can be simplified to `z` as an empty string is falsey | 11 | print("y is not an empty string") -12 | +12 | 13 | if "" != z: | ^^ PLC1901 14 | print("z is an empty string") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap index 8608edf546..7cae6936b6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2401_non_ascii_name.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- non_ascii_name.py:1:1: PLC2401 Variable name `ápple_count` contains a non-ASCII character | @@ -26,7 +25,7 @@ non_ascii_name.py:3:1: PLC2401 Variable name `ápple_count` contains a non-ASCII 2 | ápple_count += 2 # C2401 3 | ápple_count = 3 # C2401 | ^^^^^^^^^^^ PLC2401 -4 | +4 | 5 | (ápple_count for ápple_count in y) | = help: Rename the variable using ASCII characters @@ -34,7 +33,7 @@ non_ascii_name.py:3:1: PLC2401 Variable name `ápple_count` contains a non-ASCII non_ascii_name.py:5:18: PLC2401 Variable name `ápple_count` contains a non-ASCII character | 3 | ápple_count = 3 # C2401 -4 | +4 | 5 | (ápple_count for ápple_count in y) | ^^^^^^^^^^^ PLC2401 | @@ -78,10 +77,10 @@ non_ascii_name.py:18:10: PLC2401 Variable name `ápple_count` contains a non-ASC non_ascii_name.py:21:1: PLC2401 Annotation name `ápple_count` contains a non-ASCII character | 19 | pass -20 | +20 | 21 | ápple_count: int | ^^^^^^^^^^^ PLC2401 -22 | +22 | 23 | try: | = help: Rename the variable using ASCII characters diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap index 4d0f38601d..c6f20b25ba 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2403_non_ascii_module_import.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- non_ascii_module_import.py:1:29: PLC2403 Module alias `łos` contains a non-ASCII character | @@ -13,7 +12,7 @@ non_ascii_module_import.py:1:29: PLC2403 Module alias `łos` contains a non-ASCI non_ascii_module_import.py:4:24: PLC2403 Module alias `łos` contains a non-ASCII character | 2 | from os.path import join as los # OK -3 | +3 | 4 | import os.path.join as łos # Error | ^^^ PLC2403 5 | import os.path.join as los # OK @@ -23,7 +22,7 @@ non_ascii_module_import.py:4:24: PLC2403 Module alias `łos` contains a non-ASCI non_ascii_module_import.py:7:8: PLC2403 Module name `os.path.łos` contains a non-ASCII character | 5 | import os.path.join as los # OK -6 | +6 | 7 | import os.path.łos # Error (recommend an ASCII alias) | ^^^^^^^^^^^ PLC2403 8 | import os.path.los # OK @@ -33,7 +32,7 @@ non_ascii_module_import.py:7:8: PLC2403 Module name `os.path.łos` contains a no non_ascii_module_import.py:10:21: PLC2403 Module name `łos` contains a non-ASCII character | 8 | import os.path.los # OK - 9 | + 9 | 10 | from os.path import łos # Error (recommend an ASCII alias) | ^^^ PLC2403 11 | from os.path import los # OK diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap index 6c049c0b72..2946c74128 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2701_import_private_name__submodule____main__.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- __main__.py:2:16: PLC2701 Private name import `_a` | @@ -66,6 +65,6 @@ __main__.py:8:24: PLC2701 Private name import `_ddd` from external module `bbb.c 7 | import _aaa 8 | import bbb.ccc._ddd as eee # Panicked in https://github.com/astral-sh/ruff/pull/5920 | ^^^ PLC2701 - 9 | + 9 | 10 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap index bc41c2974d..e3ba6a0048 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap @@ -729,7 +729,7 @@ unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__ 45 | x = (-a).__add__(3) # PLC2801 46 | x = -(-a).__add__(3) # PLC2801 | ^^^^^^^^^^^^^^^ PLC2801 -47 | +47 | 48 | # Calls | = help: Use `+` operator @@ -749,7 +749,7 @@ unnecessary_dunder_call.py:49:7: PLC2801 Unnecessary dunder call to `__call__` 48 | # Calls 49 | print(a.__call__()) # PLC2801 (no fix, intentional) | ^^^^^^^^^^^^ PLC2801 -50 | +50 | 51 | # Lambda expressions | @@ -758,7 +758,7 @@ unnecessary_dunder_call.py:52:16: PLC2801 [*] Unnecessary dunder call to `__add_ 51 | # Lambda expressions 52 | blah = lambda: a.__add__(1) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -53 | +53 | 54 | # If expressions | = help: Use `+` operator @@ -778,7 +778,7 @@ unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__ 54 | # If expressions 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -56 | +56 | 57 | # Dict/Set/List/Tuple | = help: Use `+` operator @@ -798,7 +798,7 @@ unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub_ 54 | # If expressions 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -56 | +56 | 57 | # Dict/Set/List/Tuple | = help: Use `-` operator @@ -880,7 +880,7 @@ unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__ 60 | print([a.__add__(1)]) # PLC2801 61 | print((a.__add__(1),)) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -62 | +62 | 63 | # Comprehension variants | = help: Use `+` operator @@ -962,7 +962,7 @@ unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__ 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 67 | print((i.__add__(1) for i in range(5))) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -68 | +68 | 69 | # Generators | = help: Use `+` operator @@ -1001,7 +1001,7 @@ unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add_ 73 | # Subscripts 74 | print({"a": a.__add__(1)}["a"]) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -75 | +75 | 76 | # Starred | = help: Use `+` operator @@ -1021,7 +1021,7 @@ unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__ 76 | # Starred 77 | print(*[a.__add__(1)]) # PLC2801 | ^^^^^^^^^^^^ PLC2801 -78 | +78 | 79 | # Slices | = help: Use `+` operator @@ -1077,7 +1077,7 @@ unnecessary_dunder_call.py:92:16: PLC2801 Unnecessary dunder call to `__getattri 91 | def do_thing(self, item): 92 | return object.__getattribute__(self, item) # PLC2801 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLC2801 -93 | +93 | 94 | def use_descriptor(self, item): | = help: Access attribute directly or use getattr built-in function @@ -1085,10 +1085,10 @@ unnecessary_dunder_call.py:92:16: PLC2801 Unnecessary dunder call to `__getattri unnecessary_dunder_call.py:104:1: PLC2801 [*] Unnecessary dunder call to `__contains__`. Use `in` operator. | 102 | blah = dict[{"a": 1}.__delitem__("a")] # OK -103 | +103 | 104 | "abc".__contains__("a") | ^^^^^^^^^^^^^^^^^^^^^^^ PLC2801 -105 | +105 | 106 | # https://github.com/astral-sh/ruff/issues/14597 | = help: Use `in` operator diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap index f88db1463f..d80235c4b6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC3002_unnecessary_direct_lambda_call.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- unnecessary_direct_lambda_call.py:4:5: PLC3002 Lambda expression called directly. Execute the expression inline instead. | 2 | # pylint: disable=undefined-variable, line-too-long -3 | +3 | 4 | y = (lambda x: x**2 + 2*x + 1)(a) # [unnecessary-direct-lambda-call] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLC3002 5 | y = max((lambda x: x**2)(a), (lambda x: x+1)(a)) # [unnecessary-direct-lambda-call,unnecessary-direct-lambda-call] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap index f48dbd4ef5..7fefeeb11b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0100_yield_in_init.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- yield_in_init.py:9:9: PLE0100 `__init__` method is a generator | @@ -16,6 +15,6 @@ yield_in_init.py:14:9: PLE0100 `__init__` method is a generator 13 | def __init__(self): 14 | yield from self.gen() | ^^^^^^^^^^^^^^^^^^^^^ PLE0100 -15 | +15 | 16 | def gen(self): | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap index fb0d2c41c9..79ae8f1ae6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0101_return_in_init.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- return_in_init.py:14:9: PLE0101 Explicit return in `__init__` | @@ -8,7 +7,7 @@ return_in_init.py:14:9: PLE0101 Explicit return in `__init__` 13 | def __init__(self): 14 | return 3 | ^^^^^^^^ PLE0101 -15 | +15 | 16 | def gen(self): | @@ -17,6 +16,6 @@ return_in_init.py:22:9: PLE0101 Explicit return in `__init__` 21 | def __init__(self): 22 | return 1 | ^^^^^^^^ PLE0101 -23 | +23 | 24 | class MyClass2: | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap index 0327dcd015..5d1994780d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0118_load_before_global_declaration.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- load_before_global_declaration.py:5:11: PLE0118 Name `x` is used prior to global declaration on line 7 | @@ -8,17 +7,17 @@ load_before_global_declaration.py:5:11: PLE0118 Name `x` is used prior to global 4 | def f(): 5 | print(x) | ^ PLE0118 -6 | +6 | 7 | global x | load_before_global_declaration.py:15:11: PLE0118 Name `x` is used prior to global declaration on line 17 | 13 | global x -14 | +14 | 15 | print(x) | ^ PLE0118 -16 | +16 | 17 | global x | @@ -27,17 +26,17 @@ load_before_global_declaration.py:23:11: PLE0118 Name `x` is used prior to globa 22 | def f(): 23 | print(x) | ^ PLE0118 -24 | +24 | 25 | global x, y | load_before_global_declaration.py:33:11: PLE0118 Name `x` is used prior to global declaration on line 35 | 31 | global x, y -32 | +32 | 33 | print(x) | ^ PLE0118 -34 | +34 | 35 | global x, y | @@ -46,17 +45,17 @@ load_before_global_declaration.py:41:5: PLE0118 Name `x` is used prior to global 40 | def f(): 41 | x = 1 | ^ PLE0118 -42 | +42 | 43 | global x | load_before_global_declaration.py:51:5: PLE0118 Name `x` is used prior to global declaration on line 53 | 49 | global x -50 | +50 | 51 | x = 1 | ^ PLE0118 -52 | +52 | 53 | global x | @@ -65,17 +64,17 @@ load_before_global_declaration.py:59:9: PLE0118 Name `x` is used prior to global 58 | def f(): 59 | del x | ^ PLE0118 -60 | +60 | 61 | global x, y | load_before_global_declaration.py:69:9: PLE0118 Name `x` is used prior to global declaration on line 71 | 67 | global x, y -68 | +68 | 69 | del x | ^ PLE0118 -70 | +70 | 71 | global x, y | @@ -84,17 +83,17 @@ load_before_global_declaration.py:77:9: PLE0118 Name `x` is used prior to global 76 | def f(): 77 | del x | ^ PLE0118 -78 | +78 | 79 | global x | load_before_global_declaration.py:87:9: PLE0118 Name `x` is used prior to global declaration on line 89 | 85 | global x -86 | +86 | 87 | del x | ^ PLE0118 -88 | +88 | 89 | global x | @@ -103,17 +102,17 @@ load_before_global_declaration.py:95:9: PLE0118 Name `x` is used prior to global 94 | def f(): 95 | del x | ^ PLE0118 -96 | +96 | 97 | global x, y | load_before_global_declaration.py:105:9: PLE0118 Name `x` is used prior to global declaration on line 107 | 103 | global x, y -104 | +104 | 105 | del x | ^ PLE0118 -106 | +106 | 107 | global x, y | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap index 986b0c52d5..41db89bed4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- unexpected_special_method_signature.py:5:9: PLE0302 The special method `__bool__` expects 1 parameter, 2 were given | 3 | ... -4 | +4 | 5 | def __bool__(self, x): # too many mandatory args | ^^^^^^^^ PLE0302 6 | ... @@ -22,7 +21,7 @@ unexpected_special_method_signature.py:19:9: PLE0302 The special method `__bool_ unexpected_special_method_signature.py:32:9: PLE0302 The special method `__eq__` expects 2 parameters, 1 was given | 30 | ... -31 | +31 | 32 | def __eq__(self): # too few mandatory args | ^^^^^^ PLE0302 33 | ... @@ -31,7 +30,7 @@ unexpected_special_method_signature.py:32:9: PLE0302 The special method `__eq__` unexpected_special_method_signature.py:35:9: PLE0302 The special method `__eq__` expects 2 parameters, 3 were given | 33 | ... -34 | +34 | 35 | def __eq__(self, other, other_other): # too many mandatory args | ^^^^^^ PLE0302 36 | ... @@ -40,7 +39,7 @@ unexpected_special_method_signature.py:35:9: PLE0302 The special method `__eq__` unexpected_special_method_signature.py:44:9: PLE0302 The special method `__round__` expects between 1 and 2 parameters, 3 were given | 42 | ... -43 | +43 | 44 | def __round__(self, x, y): # disallow 2 args | ^^^^^^^^^ PLE0302 45 | ... @@ -49,7 +48,7 @@ unexpected_special_method_signature.py:44:9: PLE0302 The special method `__round unexpected_special_method_signature.py:47:9: PLE0302 The special method `__round__` expects between 1 and 2 parameters, 4 were given | 45 | ... -46 | +46 | 47 | def __round__(self, x, y, z=2): # disallow 3 args even when one is optional | ^^^^^^^^^ PLE0302 48 | ... @@ -58,7 +57,7 @@ unexpected_special_method_signature.py:47:9: PLE0302 The special method `__round unexpected_special_method_signature.py:56:9: PLE0302 The special method `__eq__` expects 2 parameters, 3 were given | 54 | ... -55 | +55 | 56 | def __eq__(self, x, y, *args): # too many args with *args | ^^^^^^ PLE0302 57 | ... @@ -67,7 +66,7 @@ unexpected_special_method_signature.py:56:9: PLE0302 The special method `__eq__` unexpected_special_method_signature.py:65:9: PLE0302 The special method `__round__` expects between 1 and 2 parameters, 3 were given | 63 | ... -64 | +64 | 65 | def __round__(self, x, y, *args): # disallow 2 args | ^^^^^^^^^ PLE0302 66 | ... diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap index 46c5c0b1b3..4f156b0611 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0304_invalid_return_type_bool.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_return_type_bool.py:5:16: PLE0304 `__bool__` does not return `bool` | @@ -8,7 +7,7 @@ invalid_return_type_bool.py:5:16: PLE0304 `__bool__` does not return `bool` 4 | def __bool__(self): 5 | return 3.05 # [invalid-bool-return] | ^^^^ PLE0304 -6 | +6 | 7 | class Int: | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap index f005580eac..775afaf683 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0604_invalid_all_object.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_all_object.py:1:1: PLE0604 Invalid object in `__all__`, must contain only strings | @@ -13,7 +12,7 @@ invalid_all_object.py:1:1: PLE0604 Invalid object in `__all__`, must contain onl invalid_all_object.py:7:1: PLE0604 Invalid object in `__all__`, must contain only strings | 5 | ) -6 | +6 | 7 | __all__ = list([None, "Fruit", "Worm"]) # [invalid-all-object] | ^^^^^^^ PLE0604 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap index 37bcd9349a..f2ae393351 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0605_invalid_all_format.py.snap @@ -1,131 +1,130 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_all_format.py:1:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 1 | __all__ = "CONST" # [invalid-all-format] | ^^^^^^^ PLE0605 -2 | +2 | 3 | __all__ = ["Hello"] + {"world"} # [invalid-all-format] | invalid_all_format.py:3:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 1 | __all__ = "CONST" # [invalid-all-format] -2 | +2 | 3 | __all__ = ["Hello"] + {"world"} # [invalid-all-format] | ^^^^^^^ PLE0605 -4 | +4 | 5 | __all__ += {"world"} # [invalid-all-format] | invalid_all_format.py:5:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 3 | __all__ = ["Hello"] + {"world"} # [invalid-all-format] -4 | +4 | 5 | __all__ += {"world"} # [invalid-all-format] | ^^^^^^^ PLE0605 -6 | +6 | 7 | __all__ = {"world"} + ["Hello"] # [invalid-all-format] | invalid_all_format.py:7:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 5 | __all__ += {"world"} # [invalid-all-format] -6 | +6 | 7 | __all__ = {"world"} + ["Hello"] # [invalid-all-format] | ^^^^^^^ PLE0605 -8 | +8 | 9 | __all__ = {"world"} + list(["Hello"]) # [invalid-all-format] | invalid_all_format.py:9:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 7 | __all__ = {"world"} + ["Hello"] # [invalid-all-format] - 8 | + 8 | 9 | __all__ = {"world"} + list(["Hello"]) # [invalid-all-format] | ^^^^^^^ PLE0605 -10 | +10 | 11 | __all__ = list(["Hello"]) + {"world"} # [invalid-all-format] | invalid_all_format.py:11:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 9 | __all__ = {"world"} + list(["Hello"]) # [invalid-all-format] -10 | +10 | 11 | __all__ = list(["Hello"]) + {"world"} # [invalid-all-format] | ^^^^^^^ PLE0605 -12 | +12 | 13 | __all__ = (x for x in ["Hello", "world"]) # [invalid-all-format] | invalid_all_format.py:13:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 11 | __all__ = list(["Hello"]) + {"world"} # [invalid-all-format] -12 | +12 | 13 | __all__ = (x for x in ["Hello", "world"]) # [invalid-all-format] | ^^^^^^^ PLE0605 -14 | +14 | 15 | __all__ = {x for x in ["Hello", "world"]} # [invalid-all-format] | invalid_all_format.py:15:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 13 | __all__ = (x for x in ["Hello", "world"]) # [invalid-all-format] -14 | +14 | 15 | __all__ = {x for x in ["Hello", "world"]} # [invalid-all-format] | ^^^^^^^ PLE0605 -16 | +16 | 17 | __all__ = foo # [invalid-all-format] | invalid_all_format.py:17:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 15 | __all__ = {x for x in ["Hello", "world"]} # [invalid-all-format] -16 | +16 | 17 | __all__ = foo # [invalid-all-format] | ^^^^^^^ PLE0605 -18 | +18 | 19 | __all__ = foo.bar # [invalid-all-format] | invalid_all_format.py:19:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 17 | __all__ = foo # [invalid-all-format] -18 | +18 | 19 | __all__ = foo.bar # [invalid-all-format] | ^^^^^^^ PLE0605 -20 | +20 | 21 | __all__ = foo["bar"] # [invalid-all-format] | invalid_all_format.py:21:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 19 | __all__ = foo.bar # [invalid-all-format] -20 | +20 | 21 | __all__ = foo["bar"] # [invalid-all-format] | ^^^^^^^ PLE0605 -22 | +22 | 23 | __all__ = (foo := bar) # [invalid-all-format] | invalid_all_format.py:23:1: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 21 | __all__ = foo["bar"] # [invalid-all-format] -22 | +22 | 23 | __all__ = (foo := bar) # [invalid-all-format] | ^^^^^^^ PLE0605 -24 | +24 | 25 | __all__ = ["Hello"] | invalid_all_format.py:23:12: PLE0605 Invalid format for `__all__`, must be `tuple` or `list` | 21 | __all__ = foo["bar"] # [invalid-all-format] -22 | +22 | 23 | __all__ = (foo := bar) # [invalid-all-format] | ^^^ PLE0605 -24 | +24 | 25 | __all__ = ["Hello"] | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap index 5297c23240..78dcba4f77 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0643_potential_index_error.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- potential_index_error.py:1:17: PLE0643 Expression is likely to raise `IndexError` | @@ -34,6 +33,6 @@ potential_index_error.py:4:17: PLE0643 Expression is likely to raise `IndexError 3 | print([1, 2, 3][999999999999999999999999999999999999999999]) # PLE0643 4 | print([1, 2, 3][-999999999999999999999999999999999999999999]) # PLE0643 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE0643 -5 | +5 | 6 | print([1, 2, 3][2]) # OK | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap index 3ea614ed29..560e9029f0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0704_misplaced_bare_raise.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- misplaced_bare_raise.py:30:5: PLE0704 Bare `raise` statement is not inside an exception handler | @@ -26,7 +25,7 @@ misplaced_bare_raise.py:41:5: PLE0704 Bare `raise` statement is not inside an ex 40 | def g(): 41 | raise # [misplaced-bare-raise] | ^^^^^ PLE0704 -42 | +42 | 43 | def h(): | @@ -46,17 +45,17 @@ misplaced_bare_raise.py:50:5: PLE0704 Bare `raise` statement is not inside an ex 49 | pass 50 | raise # [misplaced-bare-raise] | ^^^^^ PLE0704 -51 | +51 | 52 | raise # [misplaced-bare-raise] | misplaced_bare_raise.py:52:1: PLE0704 Bare `raise` statement is not inside an exception handler | 50 | raise # [misplaced-bare-raise] -51 | +51 | 52 | raise # [misplaced-bare-raise] | ^^^^^ PLE0704 -53 | +53 | 54 | try: | @@ -66,7 +65,7 @@ misplaced_bare_raise.py:58:9: PLE0704 Bare `raise` statement is not inside an ex 57 | def i(): 58 | raise # [misplaced-bare-raise] | ^^^^^ PLE0704 -59 | +59 | 60 | try: | @@ -76,7 +75,7 @@ misplaced_bare_raise.py:64:9: PLE0704 Bare `raise` statement is not inside an ex 63 | class C: 64 | raise # [misplaced-bare-raise] | ^^^^^ PLE0704 -65 | +65 | 66 | try: | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap index 18a4ebb078..c99492114a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- dict_iter_missing_items.py:13:13: PLE1141 [*] Unpacking a dictionary in iteration without calling `.items()` | @@ -24,7 +23,7 @@ dict_iter_missing_items.py:13:13: PLE1141 [*] Unpacking a dictionary in iteratio dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteration without calling `.items()` | 14 | pass -15 | +15 | 16 | for k, v in d_tuple_incorrect_tuple: | ^^^^^^^^^^^^^^^^^^^^^^^ PLE1141 17 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap index 8e9100b14a..d905356f3d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1205_logging_too_many_args.py.snap @@ -1,43 +1,42 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- logging_too_many_args.py:3:1: PLE1205 Too many arguments for `logging` format string | 1 | import logging -2 | +2 | 3 | logging.warning("Hello %s", "World!", "again") # [logging-too-many-args] | ^^^^^^^^^^^^^^^ PLE1205 -4 | +4 | 5 | logging.warning("Hello %s", "World!", "again", something="else") | logging_too_many_args.py:5:1: PLE1205 Too many arguments for `logging` format string | 3 | logging.warning("Hello %s", "World!", "again") # [logging-too-many-args] -4 | +4 | 5 | logging.warning("Hello %s", "World!", "again", something="else") | ^^^^^^^^^^^^^^^ PLE1205 -6 | +6 | 7 | logging.warning("Hello %s", "World!") | logging_too_many_args.py:29:1: PLE1205 Too many arguments for `logging` format string | 27 | from logging import info, error, warning -28 | +28 | 29 | warning("Hello %s", "World!", "again") # [logging-too-many-args] | ^^^^^^^ PLE1205 -30 | +30 | 31 | warning("Hello %s", "World!", "again", something="else") | logging_too_many_args.py:31:1: PLE1205 Too many arguments for `logging` format string | 29 | warning("Hello %s", "World!", "again") # [logging-too-many-args] -30 | +30 | 31 | warning("Hello %s", "World!", "again", something="else") | ^^^^^^^ PLE1205 -32 | +32 | 33 | warning("Hello %s", "World!") | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap index fc1a75b237..0961e1b05f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1206_logging_too_few_args.py.snap @@ -1,23 +1,22 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- logging_too_few_args.py:3:1: PLE1206 Not enough arguments for `logging` format string | 1 | import logging -2 | +2 | 3 | logging.warning("Hello %s %s", "World!") # [logging-too-few-args] | ^^^^^^^^^^^^^^^ PLE1206 -4 | +4 | 5 | # do not handle calls with kwargs (like pylint) | logging_too_few_args.py:33:1: PLE1206 Not enough arguments for `logging` format string | 31 | from logging import error, info, warning -32 | +32 | 33 | warning("Hello %s %s", "World!") # [logging-too-few-args] | ^^^^^^^ PLE1206 -34 | +34 | 35 | # do not handle calls with kwargs (like pylint) | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap index 8d0af5bba7..aed97848ee 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1300_bad_string_format_character.py.snap @@ -1,54 +1,53 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- bad_string_format_character.py:5:1: PLE1300 Unsupported format character 'z' | 3 | ## Old style formatting -4 | +4 | 5 | "%s %z" % ("hello", "world") # [bad-format-character] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1300 -6 | +6 | 7 | "%s" "%z" % ("hello", "world") # [bad-format-character] | bad_string_format_character.py:7:1: PLE1300 Unsupported format character 'z' | 5 | "%s %z" % ("hello", "world") # [bad-format-character] -6 | +6 | 7 | "%s" "%z" % ("hello", "world") # [bad-format-character] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1300 -8 | +8 | 9 | """%s %z""" % ("hello", "world") # [bad-format-character] | bad_string_format_character.py:9:1: PLE1300 Unsupported format character 'z' | 7 | "%s" "%z" % ("hello", "world") # [bad-format-character] - 8 | + 8 | 9 | """%s %z""" % ("hello", "world") # [bad-format-character] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1300 -10 | +10 | 11 | """%s""" """%z""" % ("hello", "world") # [bad-format-character] | bad_string_format_character.py:11:1: PLE1300 Unsupported format character 'z' | 9 | """%s %z""" % ("hello", "world") # [bad-format-character] -10 | +10 | 11 | """%s""" """%z""" % ("hello", "world") # [bad-format-character] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1300 -12 | +12 | 13 | ## New style formatting | bad_string_format_character.py:15:1: PLE1300 Unsupported format character 'y' | 13 | ## New style formatting -14 | +14 | 15 | "{:s} {:y}".format("hello", "world") # [bad-format-character] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1300 -16 | +16 | 17 | "{:*^30s}".format("centered") # OK | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap index 2adea4bd7b..971f3addb6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1307_bad_string_format_type.py.snap @@ -1,30 +1,29 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- bad_string_format_type.py:2:7: PLE1307 Format type does not match argument type | 1 | # Errors 2 | print("foo %(foo)d bar %(bar)d" % {"foo": "1", "bar": "2"}) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1307 -3 | +3 | 4 | "foo %e bar %s" % ("1", 2) | bad_string_format_type.py:4:1: PLE1307 Format type does not match argument type | 2 | print("foo %(foo)d bar %(bar)d" % {"foo": "1", "bar": "2"}) -3 | +3 | 4 | "foo %e bar %s" % ("1", 2) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1307 -5 | +5 | 6 | "%d" % "1" | bad_string_format_type.py:6:1: PLE1307 Format type does not match argument type | 4 | "foo %e bar %s" % ("1", 2) -5 | +5 | 6 | "%d" % "1" | ^^^^^^^^^^ PLE1307 7 | "%o" % "1" @@ -125,6 +124,6 @@ bad_string_format_type.py:16:1: PLE1307 Format type does not match argument type 15 | "%d" % ((1, 2, 3),) 16 | "%d" % (1 if x > 0 else []) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1307 -17 | +17 | 18 | # False negatives | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap index 3aa744425c..79e29de638 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1507_invalid_envvar_value.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_envvar_value.py:3:11: PLE1507 Invalid type for initial `os.getenv` argument; expected `str` | 1 | import os -2 | +2 | 3 | os.getenv(1) # [invalid-envvar-value] | ^ PLE1507 4 | os.getenv("a") @@ -48,6 +47,6 @@ invalid_envvar_value.py:14:11: PLE1507 Invalid type for initial `os.getenv` argu 13 | os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG") 14 | os.getenv(1 if using_clear_path else "PATH_ORIG") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1507 -15 | +15 | 16 | AA = "aa" | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap index 1f04b66ce6..4ec3382c4b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- singledispatch_method.py:10:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | @@ -25,7 +24,7 @@ singledispatch_method.py:10:5: PLE1519 [*] `@singledispatch` decorator should no singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | 13 | pass -14 | +14 | 15 | @singledispatch # [singledispatch-method] | ^^^^^^^^^^^^^^^ PLE1519 16 | def move(self, position): @@ -46,7 +45,7 @@ singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should no singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | 21 | pass -22 | +22 | 23 | @singledispatch # [singledispatch-method] | ^^^^^^^^^^^^^^^ PLE1519 24 | @staticmethod 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 dea1005092..b6f94b3dbf 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead | @@ -28,7 +27,7 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u 15 | b = '␈' 16 | b = f'␈' | ^ PLE2510 -17 | +17 | 18 | b_ok = '\\b' | = help: Replace with escape sequence @@ -46,10 +45,10 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" -54 | +54 | 55 | nested_fstrings = f'␈{f'{f'␛'}'}' | ^ PLE2510 -56 | +56 | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 | = help: Replace with escape sequence 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 dc7aaba7f0..72e7b93e07 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 28 | sub_ok = f'\x1a' -29 | +29 | 30 | esc = 'esc esc ␛' | ^ PLE2513 31 | esc = f'esc esc ␛' @@ -27,7 +26,7 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ 30 | esc = 'esc esc ␛' 31 | esc = f'esc esc ␛' | ^ PLE2513 -32 | +32 | 33 | esc_ok = '\x1b' | = help: Replace with escape sequence @@ -45,10 +44,10 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" -54 | +54 | 55 | nested_fstrings = f'␈{f'{f'␛'}'}' | ^ PLE2513 -56 | +56 | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 | = help: Replace with escape sequence diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap index a3d8ed567b..d7d35b39f0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- modified_iterating_set.py:4:1: PLE4703 [*] Iterated set `nums` is modified within the `for` loop | @@ -8,7 +7,7 @@ modified_iterating_set.py:4:1: PLE4703 [*] Iterated set `nums` is modified withi 4 | / for num in nums: 5 | | nums.add(num + 1) | |_____________________^ PLE4703 -6 | +6 | 7 | animals = {"dog", "cat", "cow"} | = help: Iterate over a copy of `nums` @@ -29,7 +28,7 @@ modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified wi 8 | / for animal in animals: 9 | | animals.pop("cow") | |______________________^ PLE4703 -10 | +10 | 11 | fruits = {"apple", "orange", "grape"} | = help: Iterate over a copy of `animals` @@ -50,7 +49,7 @@ modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified wi 12 | / for fruit in fruits: 13 | | fruits.clear() | |__________________^ PLE4703 -14 | +14 | 15 | planets = {"mercury", "venus", "earth"} | = help: Iterate over a copy of `fruits` @@ -71,7 +70,7 @@ modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified w 16 | / for planet in planets: 17 | | planets.discard("mercury") | |______________________________^ PLE4703 -18 | +18 | 19 | colors = {"red", "green", "blue"} | = help: Iterate over a copy of `planets` @@ -92,7 +91,7 @@ modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified wi 20 | / for color in colors: 21 | | colors.remove("red") | |________________________^ PLE4703 -22 | +22 | 23 | odds = {1, 3, 5} | = help: Iterate over a copy of `colors` @@ -114,7 +113,7 @@ modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified with 25 | | if num > 1: 26 | | odds.add(num + 1) | |_________________________^ PLE4703 -27 | +27 | 28 | # OK | = help: Iterate over a copy of `odds` diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap index c657f71a9f..6812c32fb4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0124_comparison_with_itself.py.snap @@ -1,122 +1,121 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- comparison_with_itself.py:2:1: PLR0124 Name compared with itself, consider replacing `foo == foo` | 1 | # Errors. 2 | foo == foo | ^^^ PLR0124 -3 | +3 | 4 | foo != foo | comparison_with_itself.py:4:1: PLR0124 Name compared with itself, consider replacing `foo != foo` | 2 | foo == foo -3 | +3 | 4 | foo != foo | ^^^ PLR0124 -5 | +5 | 6 | foo > foo | comparison_with_itself.py:6:1: PLR0124 Name compared with itself, consider replacing `foo > foo` | 4 | foo != foo -5 | +5 | 6 | foo > foo | ^^^ PLR0124 -7 | +7 | 8 | foo >= foo | comparison_with_itself.py:8:1: PLR0124 Name compared with itself, consider replacing `foo >= foo` | 6 | foo > foo - 7 | + 7 | 8 | foo >= foo | ^^^ PLR0124 - 9 | + 9 | 10 | foo < foo | comparison_with_itself.py:10:1: PLR0124 Name compared with itself, consider replacing `foo < foo` | 8 | foo >= foo - 9 | + 9 | 10 | foo < foo | ^^^ PLR0124 -11 | +11 | 12 | foo <= foo | comparison_with_itself.py:12:1: PLR0124 Name compared with itself, consider replacing `foo <= foo` | 10 | foo < foo -11 | +11 | 12 | foo <= foo | ^^^ PLR0124 -13 | +13 | 14 | foo is foo | comparison_with_itself.py:14:1: PLR0124 Name compared with itself, consider replacing `foo is foo` | 12 | foo <= foo -13 | +13 | 14 | foo is foo | ^^^ PLR0124 -15 | +15 | 16 | foo is not foo | comparison_with_itself.py:16:1: PLR0124 Name compared with itself, consider replacing `foo is not foo` | 14 | foo is foo -15 | +15 | 16 | foo is not foo | ^^^ PLR0124 -17 | +17 | 18 | foo in foo | comparison_with_itself.py:18:1: PLR0124 Name compared with itself, consider replacing `foo in foo` | 16 | foo is not foo -17 | +17 | 18 | foo in foo | ^^^ PLR0124 -19 | +19 | 20 | foo not in foo | comparison_with_itself.py:20:1: PLR0124 Name compared with itself, consider replacing `foo not in foo` | 18 | foo in foo -19 | +19 | 20 | foo not in foo | ^^^ PLR0124 -21 | +21 | 22 | id(foo) == id(foo) | comparison_with_itself.py:22:1: PLR0124 Name compared with itself, consider replacing `id(foo) == id(foo)` | 20 | foo not in foo -21 | +21 | 22 | id(foo) == id(foo) | ^^^^^^^ PLR0124 -23 | +23 | 24 | len(foo) == len(foo) | comparison_with_itself.py:24:1: PLR0124 Name compared with itself, consider replacing `len(foo) == len(foo)` | 22 | id(foo) == id(foo) -23 | +23 | 24 | len(foo) == len(foo) | ^^^^^^^^ PLR0124 -25 | +25 | 26 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap index aff14069c9..30bcc7a4f8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0133_comparison_of_constant.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- comparison_of_constant.py:3:4: PLR0133 Two constants compared in a comparison, consider replacing `100 == 100` | 1 | """Check that magic values are not used in comparisons""" -2 | +2 | 3 | if 100 == 100: # [comparison-of-constants] | ^^^ PLR0133 4 | pass @@ -14,7 +13,7 @@ comparison_of_constant.py:3:4: PLR0133 Two constants compared in a comparison, c comparison_of_constant.py:6:4: PLR0133 Two constants compared in a comparison, consider replacing `1 == 3` | 4 | pass -5 | +5 | 6 | if 1 == 3: # [comparison-of-constants] | ^ PLR0133 7 | pass @@ -23,7 +22,7 @@ comparison_of_constant.py:6:4: PLR0133 Two constants compared in a comparison, c comparison_of_constant.py:9:4: PLR0133 Two constants compared in a comparison, consider replacing `1 != 3` | 7 | pass - 8 | + 8 | 9 | if 1 != 3: # [comparison-of-constants] | ^ PLR0133 10 | pass @@ -40,7 +39,7 @@ comparison_of_constant.py:13:4: PLR0133 Two constants compared in a comparison, comparison_of_constant.py:23:4: PLR0133 Two constants compared in a comparison, consider replacing `1 > 0` | 21 | pass -22 | +22 | 23 | if 1 > 0: # [comparison-of-constants] | ^ PLR0133 24 | pass @@ -49,7 +48,7 @@ comparison_of_constant.py:23:4: PLR0133 Two constants compared in a comparison, comparison_of_constant.py:29:4: PLR0133 Two constants compared in a comparison, consider replacing `1 >= 0` | 27 | pass -28 | +28 | 29 | if 1 >= 0: # [comparison-of-constants] | ^ PLR0133 30 | pass @@ -58,7 +57,7 @@ comparison_of_constant.py:29:4: PLR0133 Two constants compared in a comparison, comparison_of_constant.py:35:4: PLR0133 Two constants compared in a comparison, consider replacing `1 < 0` | 33 | pass -34 | +34 | 35 | if 1 < 0: # [comparison-of-constants] | ^ PLR0133 36 | pass @@ -67,7 +66,7 @@ comparison_of_constant.py:35:4: PLR0133 Two constants compared in a comparison, comparison_of_constant.py:41:4: PLR0133 Two constants compared in a comparison, consider replacing `1 <= 0` | 39 | pass -40 | +40 | 41 | if 1 <= 0: # [comparison-of-constants] | ^ PLR0133 42 | pass @@ -76,7 +75,7 @@ comparison_of_constant.py:41:4: PLR0133 Two constants compared in a comparison, comparison_of_constant.py:51:4: PLR0133 Two constants compared in a comparison, consider replacing `"hello" == ""` | 49 | pass -50 | +50 | 51 | if "hello" == "": # [comparison-of-constants] | ^^^^^^^ PLR0133 52 | pass @@ -85,7 +84,7 @@ comparison_of_constant.py:51:4: PLR0133 Two constants compared in a comparison, comparison_of_constant.py:58:4: PLR0133 Two constants compared in a comparison, consider replacing `True == False` | 56 | pass -57 | +57 | 58 | if True == False: # [comparison-of-constants] | ^^^^ PLR0133 59 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap index d865538446..ab698ec5d0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0912_too_many_branches.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- too_many_branches.py:8:5: PLR0912 Too many branches (13 > 12) | @@ -14,7 +13,7 @@ too_many_branches.py:8:5: PLR0912 Too many branches (13 > 12) too_many_branches.py:80:5: PLR0912 Too many branches (13 > 12) | 78 | pass -79 | +79 | 80 | def with_statement_wrong(): | ^^^^^^^^^^^^^^^^^^^^ PLR0912 81 | """statements inside the with statement should get counted""" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap index 293664ff30..43145d416a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0917_too_many_positional_arguments.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- too_many_positional_arguments.py:1:5: PLR0917 Too many positional arguments (8/5) | @@ -26,7 +25,7 @@ too_many_positional_arguments.py:29:5: PLR0917 Too many positional arguments (6/ too_many_positional_arguments.py:43:9: PLR0917 Too many positional arguments (6/5) | 41 | pass -42 | +42 | 43 | def f(self, a, b, c, d, e, g): # Too many positional arguments (6/5) | ^ PLR0917 44 | pass 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 142e76e87f..7e75b2ed09 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 @@ -6,7 +6,7 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa 1 | # Errors. 2 | foo == "a" or foo == "b" | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -3 | +3 | 4 | foo != "a" and foo != "b" | = help: Merge multiple comparisons @@ -22,10 +22,10 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b")`. Use a `set` if the elements are hashable. | 2 | foo == "a" or foo == "b" -3 | +3 | 4 | foo != "a" and foo != "b" | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -5 | +5 | 6 | foo == "a" or foo == "b" or foo == "c" | = help: Merge multiple comparisons @@ -43,10 +43,10 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 4 | foo != "a" and foo != "b" -5 | +5 | 6 | foo == "a" or foo == "b" or foo == "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -7 | +7 | 8 | foo != "a" and foo != "b" and foo != "c" | = help: Merge multiple comparisons @@ -64,10 +64,10 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 6 | foo == "a" or foo == "b" or foo == "c" - 7 | + 7 | 8 | foo != "a" and foo != "b" and foo != "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 - 9 | + 9 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. | = help: Merge multiple comparisons @@ -85,10 +85,10 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (a, "b", 3)`. Use a `set` if the elements are hashable. | 8 | foo != "a" and foo != "b" and foo != "c" - 9 | + 9 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -11 | +11 | 12 | "a" == foo or "b" == foo or "c" == foo | = help: Merge multiple comparisons @@ -106,10 +106,10 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. -11 | +11 | 12 | "a" == foo or "b" == foo or "c" == foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -13 | +13 | 14 | "a" != foo and "b" != foo and "c" != foo | = help: Merge multiple comparisons @@ -127,10 +127,10 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 12 | "a" == foo or "b" == foo or "c" == foo -13 | +13 | 14 | "a" != foo and "b" != foo and "c" != foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -15 | +15 | 16 | "a" == foo or foo == "b" or "c" == foo | = help: Merge multiple comparisons @@ -148,10 +148,10 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 14 | "a" != foo and "b" != foo and "c" != foo -15 | +15 | 16 | "a" == foo or foo == "b" or "c" == foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -17 | +17 | 18 | foo == bar or baz == foo or qux == foo | = help: Merge multiple comparisons @@ -169,10 +169,10 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (bar, baz, qux)`. Use a `set` if the elements are hashable. | 16 | "a" == foo or foo == "b" or "c" == foo -17 | +17 | 18 | foo == bar or baz == foo or qux == foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -19 | +19 | 20 | foo == "a" or "b" == foo or foo == "c" | = help: Merge multiple comparisons @@ -190,10 +190,10 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 18 | foo == bar or baz == foo or qux == foo -19 | +19 | 20 | foo == "a" or "b" == foo or foo == "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -21 | +21 | 22 | foo != "a" and "b" != foo and foo != "c" | = help: Merge multiple comparisons @@ -211,10 +211,10 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 20 | foo == "a" or "b" == foo or foo == "c" -21 | +21 | 22 | foo != "a" and "b" != foo and foo != "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -23 | +23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | = help: Merge multiple comparisons @@ -232,10 +232,10 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. | 22 | foo != "a" and "b" != foo and foo != "c" -23 | +23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -25 | +25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | = help: Merge multiple comparisons @@ -253,10 +253,10 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. | 22 | foo != "a" and "b" != foo and foo != "c" -23 | +23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -25 | +25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | = help: Merge multiple comparisons @@ -274,10 +274,10 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comparisons: `foo.bar in ("a", "b")`. Use a `set` if the elements are hashable. | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets -25 | +25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -27 | +27 | 28 | # OK | = help: Merge multiple comparisons @@ -295,10 +295,10 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. | 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets -60 | +60 | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -62 | +62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | = help: Merge multiple comparisons @@ -316,10 +316,10 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets -62 | +62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -64 | +64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | = help: Merge multiple comparisons @@ -337,10 +337,10 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets -62 | +62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -64 | +64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | = help: Merge multiple comparisons @@ -358,10 +358,10 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets -64 | +64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -66 | +66 | 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets | = help: Merge multiple comparisons @@ -379,10 +379,10 @@ repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple com repeated_equality_comparison.py:69:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (1, True)`. Use a `set` if the elements are hashable. | 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets -68 | +68 | 69 | foo == 1 or foo == True # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -70 | +70 | 71 | foo == 1 or foo == 1.0 # Different types, same hashed value | = help: Merge multiple comparisons @@ -400,10 +400,10 @@ repeated_equality_comparison.py:69:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:71:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (1, 1.0)`. Use a `set` if the elements are hashable. | 69 | foo == 1 or foo == True # Different types, same hashed value -70 | +70 | 71 | foo == 1 or foo == 1.0 # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -72 | +72 | 73 | foo == False or foo == 0 # Different types, same hashed value | = help: Merge multiple comparisons @@ -421,10 +421,10 @@ repeated_equality_comparison.py:71:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:73:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (False, 0)`. Use a `set` if the elements are hashable. | 71 | foo == 1 or foo == 1.0 # Different types, same hashed value -72 | +72 | 73 | foo == False or foo == 0 # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -74 | +74 | 75 | foo == 0.0 or foo == 0j # Different types, same hashed value | = help: Merge multiple comparisons @@ -441,7 +441,7 @@ repeated_equality_comparison.py:73:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:75:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (0.0, 0j)`. Use a `set` if the elements are hashable. | 73 | foo == False or foo == 0 # Different types, same hashed value -74 | +74 | 75 | foo == 0.0 or foo == 0j # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 | 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 906f9ad6c9..986e16f9b2 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | import sys -2 | +2 | 3 | exit(0) | ^^^^ PLR1722 4 | quit(0) @@ -80,7 +79,7 @@ sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` sys_exit_alias_1.py:15:5: PLR1722 Use `sys.exit()` instead of `exit` | 13 | sys = 1 -14 | +14 | 15 | exit(1) | ^^^^ PLR1722 16 | quit(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 8c3556438b..3475c756f2 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | from sys import * -2 | +2 | 3 | exit(0) | ^^^^ PLR1722 | 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 956a1ed942..081f770791 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | import os \ -2 | +2 | 3 | exit(0) | ^^^^ PLR1722 | 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 96d4b0f316..fa77515597 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | import sys as sys2 -2 | +2 | 3 | exit(0) | ^^^^ PLR1722 4 | quit(0) 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 5c81a57432..5f17881fe8 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | from sys import exit as exit2 -2 | +2 | 3 | exit(0) | ^^^^ PLR1722 4 | quit(0) 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 d8b3a11512..99a789f9ef 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | from sys import * -2 | +2 | 3 | exit(0) | ^^^^ PLR1722 4 | quit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap index dbbcead379..44822f1e92 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- unnecessary_dict_index_lookup.py:4:6: PLR1733 [*] Unnecessary lookup of dictionary value by key | @@ -48,7 +47,7 @@ unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of diction 5 | {FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 6 | {fruit_name: FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 | ^^^^^^^^^^^^^^^^^^ PLR1733 -7 | +7 | 8 | for fruit_name, fruit_count in FRUITS.items(): | = help: Use existing variable diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap index f187241d63..af6f0edc26 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerate()` loop | @@ -48,7 +47,7 @@ unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumera 8 | {letters[index] for index, letter in enumerate(letters)} # PLR1736 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 | ^^^^^^^^^^^^^^ PLR1736 -10 | +10 | 11 | for index, letter in enumerate(letters): | = help: Use the loop variable directly @@ -109,7 +108,7 @@ unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumer 13 | blah = letters[index] # PLR1736 14 | assert letters[index] == "d" # PLR1736 | ^^^^^^^^^^^^^^ PLR1736 -15 | +15 | 16 | for index, letter in builtins.enumerate(letters): | = help: Use the loop variable directly @@ -189,7 +188,7 @@ unnecessary_list_index_lookup.py:74:15: PLR1736 [*] List index lookup in `enumer 73 | for index, list_item in enumerate(some_list, start=0): 74 | print(some_list[index]) | ^^^^^^^^^^^^^^^^ PLR1736 -75 | +75 | 76 | # PLR1736 | = help: Use the loop variable directly diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap index 1c179c1311..d5b501687f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2004_magic_value_comparison.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- magic_value_comparison.py:5:4: PLR2004 Magic value used in comparison, consider replacing `10` with a constant variable | 3 | user_input = 10 -4 | +4 | 5 | if 10 > user_input: # [magic-value-comparison] | ^^ PLR2004 6 | pass @@ -14,7 +13,7 @@ magic_value_comparison.py:5:4: PLR2004 Magic value used in comparison, consider magic_value_comparison.py:47:12: PLR2004 Magic value used in comparison, consider replacing `2` with a constant variable | 45 | pass -46 | +46 | 47 | if argc != 2: # [magic-value-comparison] | ^ PLR2004 48 | pass @@ -23,7 +22,7 @@ magic_value_comparison.py:47:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:50:12: PLR2004 Magic value used in comparison, consider replacing `-2` with a constant variable | 48 | pass -49 | +49 | 50 | if argc != -2: # [magic-value-comparison] | ^^ PLR2004 51 | pass @@ -32,7 +31,7 @@ magic_value_comparison.py:50:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:53:12: PLR2004 Magic value used in comparison, consider replacing `+2` with a constant variable | 51 | pass -52 | +52 | 53 | if argc != +2: # [magic-value-comparison] | ^^ PLR2004 54 | pass @@ -41,7 +40,7 @@ magic_value_comparison.py:53:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:56:12: PLR2004 Magic value used in comparison, consider replacing `-2.0` with a constant variable | 54 | pass -55 | +55 | 56 | if argc != -2.0: # [magic-value-comparison] | ^^^^ PLR2004 57 | pass @@ -50,7 +49,7 @@ magic_value_comparison.py:56:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:59:12: PLR2004 Magic value used in comparison, consider replacing `+2.0` with a constant variable | 57 | pass -58 | +58 | 59 | if argc != +2.0: # [magic-value-comparison] | ^^^^ PLR2004 60 | pass @@ -59,7 +58,7 @@ magic_value_comparison.py:59:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:80:21: PLR2004 Magic value used in comparison, consider replacing `3.141592653589793238` with a constant variable | 78 | pi_estimation = 3.14 -79 | +79 | 80 | if pi_estimation == 3.141592653589793238: # [magic-value-comparison] | ^^^^^^^^^^^^^^^^^^^^ PLR2004 81 | pass @@ -68,7 +67,7 @@ magic_value_comparison.py:80:21: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:86:21: PLR2004 Magic value used in comparison, consider replacing `0x3` with a constant variable | 84 | pass -85 | +85 | 86 | if pi_estimation == 0x3: # [magic-value-comparison] | ^^^ PLR2004 87 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap index 5b9ce7cf4a..5b1a959bda 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- empty_comment.py:3:1: PLR2044 [*] Line with empty comment | @@ -46,7 +45,7 @@ empty_comment.py:5:9: PLR2044 [*] Line with empty comment 4 | # 5 | # | ^ PLR2044 -6 | +6 | 7 | # this non-empty comment has trailing whitespace and is OK | = help: Delete the empty comment @@ -81,7 +80,7 @@ empty_comment.py:18:11: PLR2044 [*] Line with empty comment empty_comment.py:44:1: PLR2044 [*] Line with empty comment | 42 | # These should be removed, despite being an empty "block comment". -43 | +43 | 44 | # | ^ PLR2044 45 | # @@ -102,7 +101,7 @@ empty_comment.py:45:1: PLR2044 [*] Line with empty comment 44 | # 45 | # | ^ PLR2044 -46 | +46 | 47 | # These should also be removed. | = help: Delete the empty comment diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap index 9255a22035..9de292825b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- non_augmented_assignment.py:16:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 14 | mat1, mat2 = None, None -15 | +15 | 16 | some_string = some_string + "a very long end of string" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR6104 17 | index = index - 1 @@ -384,7 +383,7 @@ non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented a 34 | mat1 = mat1 @ mat2 35 | a_list[1] = a_list[1] + 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR6104 -36 | +36 | 37 | a_list[0:2] = a_list[0:2] * 3 | = help: Replace with augmented assignment @@ -402,7 +401,7 @@ non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented a non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 35 | a_list[1] = a_list[1] + 1 -36 | +36 | 37 | a_list[0:2] = a_list[0:2] * 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR6104 38 | a_list[:2] = a_list[:2] * 3 @@ -466,7 +465,7 @@ non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented a 39 | a_list[1:] = a_list[1:] * 3 40 | a_list[:] = a_list[:] * 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR6104 -41 | +41 | 42 | index = index * (index + 10) | = help: Replace with augmented assignment @@ -484,7 +483,7 @@ non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented a non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 40 | a_list[:] = a_list[:] * 3 -41 | +41 | 42 | index = index * (index + 10) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR6104 | @@ -541,7 +540,7 @@ non_augmented_assignment.py:54:1: PLR6104 [*] Use `+=` to perform an augmented a | 54 | a = a+-1 | ^^^^^^^^ PLR6104 -55 | +55 | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/11672 | = help: Replace with augmented assignment @@ -562,7 +561,7 @@ non_augmented_assignment.py:58:1: PLR6104 [*] Use `+=` to perform an augmented a 57 | test = 0x5 58 | test = test + 0xBA | ^^^^^^^^^^^^^^^^^^ PLR6104 -59 | +59 | 60 | test2 = b"" | = help: Replace with augmented assignment @@ -582,7 +581,7 @@ non_augmented_assignment.py:61:1: PLR6104 [*] Use `+=` to perform an augmented a 60 | test2 = b"" 61 | test2 = test2 + b"\000" | ^^^^^^^^^^^^^^^^^^^^^^^ PLR6104 -62 | +62 | 63 | test3 = "" | = help: Replace with augmented assignment @@ -603,7 +602,7 @@ non_augmented_assignment.py:64:1: PLR6104 [*] Use `+=` to perform an augmented a 64 | / test3 = test3 + ( a := R"" 65 | | f"oo" ) | |__________________________________^ PLR6104 -66 | +66 | 67 | test4 = [] | = help: Replace with augmented assignment @@ -626,7 +625,7 @@ non_augmented_assignment.py:68:1: PLR6104 [*] Use `+=` to perform an augmented a 70 | | range(10) 71 | | ) | |___________________^ PLR6104 -72 | +72 | 73 | test5 = test5 + ( | = help: Replace with augmented assignment @@ -644,14 +643,14 @@ non_augmented_assignment.py:68:1: PLR6104 [*] Use `+=` to perform an augmented a non_augmented_assignment.py:73:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 71 | ) -72 | +72 | 73 | / test5 = test5 + ( 74 | | 4 75 | | * 76 | | 10 77 | | ) | |_^ PLR6104 -78 | +78 | 79 | test6 = test6 + \ | = help: Replace with augmented assignment @@ -669,7 +668,7 @@ non_augmented_assignment.py:73:1: PLR6104 [*] Use `+=` to perform an augmented a non_augmented_assignment.py:79:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 77 | ) -78 | +78 | 79 | / test6 = test6 + \ 80 | | ( 81 | | 4 @@ -677,7 +676,7 @@ non_augmented_assignment.py:79:1: PLR6104 [*] Use `+=` to perform an augmented a 83 | | 10 84 | | ) | |_________^ PLR6104 -85 | +85 | 86 | test7 = \ | = help: Replace with augmented assignment @@ -696,12 +695,12 @@ non_augmented_assignment.py:79:1: PLR6104 [*] Use `+=` to perform an augmented a non_augmented_assignment.py:86:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 84 | ) -85 | +85 | 86 | / test7 = \ 87 | | 100 \ 88 | | + test7 | |___________^ PLR6104 -89 | +89 | 90 | test8 = \ | = help: Replace with augmented assignment @@ -721,7 +720,7 @@ non_augmented_assignment.py:86:1: PLR6104 [*] Use `+=` to perform an augmented a non_augmented_assignment.py:90:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 88 | + test7 -89 | +89 | 90 | / test8 = \ 91 | | 886 \ 92 | | + \ 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 0a05dcb711..273ce58e09 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for membership | @@ -73,7 +72,7 @@ literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membe 8 | "cherry" in fruits 9 | _ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in ("a", "b")} | ^^^^^^^^^^ PLR6201 -10 | +10 | 11 | # OK | = help: Convert to `set` diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap index b1da0df29e..e53bcc34e8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- no_self_use.py:7:9: PLR6301 Method `developer_greeting` could be a function, class method, or static method | @@ -13,7 +12,7 @@ no_self_use.py:7:9: PLR6301 Method `developer_greeting` could be a function, cla no_self_use.py:10:9: PLR6301 Method `greeting_1` could be a function, class method, or static method | 8 | print(f"Greetings {name}!") - 9 | + 9 | 10 | def greeting_1(self): # [no-self-use] | ^^^^^^^^^^ PLR6301 11 | print("Hello!") @@ -22,7 +21,7 @@ no_self_use.py:10:9: PLR6301 Method `greeting_1` could be a function, class meth no_self_use.py:13:9: PLR6301 Method `greeting_2` could be a function, class method, or static method | 11 | print("Hello!") -12 | +12 | 13 | def greeting_2(self): # [no-self-use] | ^^^^^^^^^^ PLR6301 14 | print("Hi!") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap index 0bff37af89..e4e25f27e6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- unnecessary_lambda.py:1:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -22,7 +21,7 @@ unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 1 | _ = lambda: print() # [unnecessary-lambda] 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] | ^^^^^^^^^^^^^^^^^^^^^^ PLW0108 -3 | +3 | 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] | = help: Inline function call @@ -38,7 +37,7 @@ unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlin unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] -3 | +3 | 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] | ^^^^^^^^^^^^^^^^^^^^^^ PLW0108 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] @@ -102,7 +101,7 @@ unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0108 -8 | +8 | 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] | = help: Inline function call @@ -120,7 +119,7 @@ unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlin unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] - 8 | + 8 | 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0108 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] @@ -142,7 +141,7 @@ unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inli 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0108 -11 | +11 | 12 | # default value in lambda parameters | = help: Inline function call diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap index 8d16fb473a..0a03d7a4c4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- useless_else_on_loop.py:9:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | @@ -49,7 +48,7 @@ useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 28 | break -29 | +29 | 30 | else: # [useless-else-on-loop] | ^^^^ PLW0120 31 | print("or else!") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap index 6c9031d4c1..e1489cb2ab 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0127_self_assigning_variable.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- self_assigning_variable.py:6:1: PLW0127 Self-assignment of variable `foo` | @@ -395,7 +394,7 @@ self_assigning_variable.py:28:2: PLW0127 Self-assignment of variable `foo` 27 | (foo, bar) = (foo, bar) = baz 28 | (foo, bar) = baz = (foo, bar) = 1 | ^^^ PLW0127 -29 | +29 | 30 | # Non-errors. | @@ -405,6 +404,6 @@ self_assigning_variable.py:28:7: PLW0127 Self-assignment of variable `bar` 27 | (foo, bar) = (foo, bar) = baz 28 | (foo, bar) = baz = (foo, bar) = 1 | ^^^ PLW0127 -29 | +29 | 30 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap index 66b84a4bcc..c3f54bdf9b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0128_redeclared_assigned_name.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- redeclared_assigned_name.py:1:8: PLW0128 Redeclared variable `FIRST` in assignment | @@ -43,7 +42,7 @@ redeclared_assigned_name.py:4:23: PLW0128 Redeclared variable `FIRST` in assignm 3 | FIRST, (FIRST, SECOND, (THIRD, FIRST)) = (1, (1, 2)) # PLW0128 4 | FIRST, SECOND, THIRD, FIRST, SECOND = (1, 2, 3, 4) # PLW0128 | ^^^^^ PLW0128 -5 | +5 | 6 | FIRST, SECOND, _, _, _ignored = (1, 2, 3, 4, 5) # OK | @@ -53,6 +52,6 @@ redeclared_assigned_name.py:4:30: PLW0128 Redeclared variable `SECOND` in assign 3 | FIRST, (FIRST, SECOND, (THIRD, FIRST)) = (1, (1, 2)) # PLW0128 4 | FIRST, SECOND, THIRD, FIRST, SECOND = (1, 2, 3, 4) # PLW0128 | ^^^^^^ PLW0128 -5 | +5 | 6 | FIRST, SECOND, _, _, _ignored = (1, 2, 3, 4, 5) # OK | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap index c4293a4ef0..120302d3df 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0129_assert_on_string_literal.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- assert_on_string_literal.py:3:12: PLW0129 Asserting on a non-empty string literal will always pass | @@ -25,7 +24,7 @@ assert_on_string_literal.py:14:12: PLW0129 Asserting on a non-empty string liter 13 | except: 14 | assert "bad again" # [assert-on-string-literal] | ^^^^^^^^^^^ PLW0129 -15 | +15 | 16 | a = 12 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap index 4593aa5e54..9df03f0994 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- useless_exception_statement.py:7:5: PLW0133 [*] Missing `raise` statement on exception | @@ -86,7 +85,7 @@ useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on ex 33 | def inner(): 34 | IndexError("This is an exception") # PLW0133 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0133 -35 | +35 | 36 | inner() | = help: Add `raise` keyword @@ -218,10 +217,10 @@ useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on ex useless_exception_statement.py:126:1: PLW0133 [*] Missing `raise` statement on exception | 124 | import builtins -125 | +125 | 126 | builtins.TypeError("still an exception even though it's an Attribute") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0133 -127 | +127 | 128 | PythonFinalizationError("Added in Python 3.13") | = help: Add `raise` keyword @@ -238,7 +237,7 @@ useless_exception_statement.py:126:1: PLW0133 [*] Missing `raise` statement on e useless_exception_statement.py:128:1: PLW0133 [*] Missing `raise` statement on exception | 126 | builtins.TypeError("still an exception even though it's an Attribute") -127 | +127 | 128 | PythonFinalizationError("Added in Python 3.13") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0133 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap index 40a663dc5b..3ba04a3cec 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0602_global_variable_not_assigned.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- global_variable_not_assigned.py:5:12: PLW0602 Using global for `X` but no assignment is done | @@ -15,6 +14,6 @@ global_variable_not_assigned.py:9:12: PLW0602 Using global for `X` but no assign 8 | def f(): 9 | global X | ^ PLW0602 -10 | +10 | 11 | print(X) | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap index 8258c72238..30959b0b11 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0603_global_statement.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- global_statement.py:17:12: PLW0603 Using the global statement to update `CONSTANT` is discouraged | @@ -56,7 +55,7 @@ global_statement.py:50:12: PLW0603 Using the global statement to update `CONSTAN 49 | """Function assigns should only throw a global statement error""" 50 | global CONSTANT # [global-statement] | ^^^^^^^^ PLW0603 -51 | +51 | 52 | def CONSTANT(): | @@ -66,7 +65,7 @@ global_statement.py:60:12: PLW0603 Using the global statement to update `FUNC` i 59 | """Overriding a function should only throw a global statement error""" 60 | global FUNC # [global-statement] | ^^^^ PLW0603 -61 | +61 | 62 | def FUNC(): | @@ -76,7 +75,7 @@ global_statement.py:70:12: PLW0603 Using the global statement to update `CLASS` 69 | """Overriding a class should only throw a global statement error""" 70 | global CLASS # [global-statement] | ^^^^^ PLW0603 -71 | +71 | 72 | class CLASS: | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap index ef9766f7b3..7ca2dd0b69 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0604_global_at_module_level.py.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- global_at_module_level.py:1:1: PLW0604 `global` at module level is redundant | 1 | global price # W0604 | ^^^^^^^^^^^^ PLW0604 -2 | +2 | 3 | price = 25 | @@ -15,6 +14,6 @@ global_at_module_level.py:6:5: PLW0604 `global` at module level is redundant 5 | if True: 6 | global X # W0604 | ^^^^^^^^ PLW0604 -7 | +7 | 8 | def no_error(): | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap index b6b4c7ff2d..2192975c9a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- self_or_cls_assignment.py:4:9: PLW0642 Reassigned `cls` variable in class method | @@ -62,7 +61,7 @@ self_or_cls_assignment.py:10:16: PLW0642 Reassigned `cls` variable in class meth 9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ^^^ PLW0642 -11 | +11 | 12 | @classmethod | = help: Consider using a different variable name @@ -73,7 +72,7 @@ self_or_cls_assignment.py:14:9: PLW0642 Reassigned `cls` variable in class metho 13 | def add_fruits(cls, fruits, /) -> None: 14 | cls = fruits # PLW0642 | ^^^ PLW0642 -15 | +15 | 16 | def print_color(self) -> None: | = help: Consider using a different variable name @@ -137,7 +136,7 @@ self_or_cls_assignment.py:23:16: PLW0642 Reassigned `self` variable in instance 22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ^^^^ PLW0642 -24 | +24 | 25 | def print_color(self, color, /) -> None: | = help: Consider using a different variable name @@ -147,7 +146,7 @@ self_or_cls_assignment.py:26:9: PLW0642 Reassigned `self` variable in instance m 25 | def print_color(self, color, /) -> None: 26 | self = color | ^^^^ PLW0642 -27 | +27 | 28 | def ok(self) -> None: | = help: Consider using a different variable name diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap index 6b93f039ff..6c19b91ebe 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1501_bad_open_mode.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- bad_open_mode.py:11:12: PLW1501 `rwx` is not a valid mode for `open` | @@ -107,7 +106,7 @@ bad_open_mode.py:34:25: PLW1501 `rwx` is not a valid mode for `open` 33 | pathlib.Path(NAME).open(mode="rwx") # [bad-open-mode] 34 | pathlib.Path(NAME).open("rwx", encoding="utf-8") # [bad-open-mode] | ^^^^^ PLW1501 -35 | +35 | 36 | import builtins | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1507_shallow_copy_environ.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1507_shallow_copy_environ.py.snap index e6b1d9adb4..c59f03fdf2 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1507_shallow_copy_environ.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1507_shallow_copy_environ.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- shallow_copy_environ.py:4:14: PLW1507 [*] Shallow copy of `os.environ` via `copy.copy(os.environ)` | 2 | import os -3 | +3 | 4 | copied_env = copy.copy(os.environ) # [shallow-copy-environ] | ^^^^^^^^^^^^^^^^^^^^^ PLW1507 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap index 1b06d83baa..b1fed4b4b9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1508_invalid_envvar_default.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_envvar_default.py:3:29: PLW1508 Invalid type for environment variable default; expected `str` or `None` | 1 | import os -2 | +2 | 3 | tempVar = os.getenv("TEST", 12) # [invalid-envvar-default] | ^^ PLW1508 4 | goodVar = os.getenv("TESTING", None) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap index 8a03622b19..9918c300e9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1509_subprocess_popen_preexec_fn.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- subprocess_popen_preexec_fn.py:9:18: PLW1509 `preexec_fn` argument is unsafe when using threads | @@ -36,6 +35,6 @@ subprocess_popen_preexec_fn.py:12:26: PLW1509 `preexec_fn` argument is unsafe wh 11 | subprocess.Popen(preexec_fn=lambda: print("Hello, world!")) 12 | subprocess.Popen(["ls"], preexec_fn=lambda: print("Hello, world!")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW1509 -13 | +13 | 14 | # Non-errors. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap index 275cf6d41a..7e6539ec04 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- subprocess_run_without_check.py:4:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | @@ -70,7 +69,7 @@ subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without expli 9 | ) 10 | subprocess.run(["ls"], **kwargs) | ^^^^^^^^^^^^^^ PLW1510 -11 | +11 | 12 | # Non-errors. | = help: Add explicit `check=False` diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap index cd39d99241..cc91be3fd9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- unspecified_encoding.py:8:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -132,7 +131,7 @@ unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in tex 13 | codecs.open("test.txt") 14 | tempfile.SpooledTemporaryFile(0, "w") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW1514 -15 | +15 | 16 | # Non-errors. | = help: Add explicit `encoding` argument @@ -150,7 +149,7 @@ unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in tex unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 44 | tempfile.SpooledTemporaryFile(0, ) -45 | +45 | 46 | open("test.txt",) | ^^^^ PLW1514 47 | open() @@ -296,7 +295,7 @@ unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit ` unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 62 | ) -63 | +63 | 64 | open((("test.txt")),) | ^^^^ PLW1514 65 | open( @@ -422,7 +421,7 @@ unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without 79 | text = Path("foo.txt").read_text() 80 | Path("foo.txt").write_text(text) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW1514 -81 | +81 | 82 | # Non-errors. | = help: Add explicit `encoding` argument diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap index 33ba7d3796..572aabdcba 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1641_eq_without_hash.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- eq_without_hash.py:3:7: PLW1641 Object does not implement `__hash__` method | 1 | ### Errors -2 | +2 | 3 | class Person: | ^^^^^^ PLW1641 4 | def __init__(self): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap index 9adf2b8cf5..8f42ef34e9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2101_useless_with_lock.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- useless_with_lock.py:5:6: PLW2101 Threading lock directly created in `with` statement has no effect | @@ -12,7 +11,7 @@ useless_with_lock.py:5:6: PLW2101 Threading lock directly created in `with` stat useless_with_lock.py:8:6: PLW2101 Threading lock directly created in `with` statement has no effect | 6 | ... -7 | +7 | 8 | with Lock(): # [useless-with-lock] | ^^^^^^ PLW2101 9 | ... @@ -21,7 +20,7 @@ useless_with_lock.py:8:6: PLW2101 Threading lock directly created in `with` stat useless_with_lock.py:11:6: PLW2101 Threading lock directly created in `with` statement has no effect | 9 | ... -10 | +10 | 11 | with threading.Lock() as this_shouldnt_matter: # [useless-with-lock] | ^^^^^^^^^^^^^^^^ PLW2101 12 | ... @@ -30,7 +29,7 @@ useless_with_lock.py:11:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:14:6: PLW2101 Threading lock directly created in `with` statement has no effect | 12 | ... -13 | +13 | 14 | with threading.RLock(): # [useless-with-lock] | ^^^^^^^^^^^^^^^^^ PLW2101 15 | ... @@ -39,7 +38,7 @@ useless_with_lock.py:14:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:17:6: PLW2101 Threading lock directly created in `with` statement has no effect | 15 | ... -16 | +16 | 17 | with RLock(): # [useless-with-lock] | ^^^^^^^ PLW2101 18 | ... @@ -48,7 +47,7 @@ useless_with_lock.py:17:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:20:6: PLW2101 Threading lock directly created in `with` statement has no effect | 18 | ... -19 | +19 | 20 | with threading.Condition(): # [useless-with-lock] | ^^^^^^^^^^^^^^^^^^^^^ PLW2101 21 | ... @@ -57,7 +56,7 @@ useless_with_lock.py:20:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:23:6: PLW2101 Threading lock directly created in `with` statement has no effect | 21 | ... -22 | +22 | 23 | with Condition(): # [useless-with-lock] | ^^^^^^^^^^^ PLW2101 24 | ... @@ -66,7 +65,7 @@ useless_with_lock.py:23:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:26:6: PLW2101 Threading lock directly created in `with` statement has no effect | 24 | ... -25 | +25 | 26 | with threading.Semaphore(): # [useless-with-lock] | ^^^^^^^^^^^^^^^^^^^^^ PLW2101 27 | ... @@ -75,7 +74,7 @@ useless_with_lock.py:26:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:29:6: PLW2101 Threading lock directly created in `with` statement has no effect | 27 | ... -28 | +28 | 29 | with Semaphore(): # [useless-with-lock] | ^^^^^^^^^^^ PLW2101 30 | ... @@ -84,7 +83,7 @@ useless_with_lock.py:29:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:32:6: PLW2101 Threading lock directly created in `with` statement has no effect | 30 | ... -31 | +31 | 32 | with threading.BoundedSemaphore(): # [useless-with-lock] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW2101 33 | ... @@ -93,7 +92,7 @@ useless_with_lock.py:32:6: PLW2101 Threading lock directly created in `with` sta useless_with_lock.py:35:6: PLW2101 Threading lock directly created in `with` statement has no effect | 33 | ... -34 | +34 | 35 | with BoundedSemaphore(): # [useless-with-lock] | ^^^^^^^^^^^^^^^^^^ PLW2101 36 | ... diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap index e834d0c89f..8bb2aff29e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW2901_redefined_loop_name.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- redefined_loop_name.py:6:9: PLW2901 Outer `for` loop variable `i` overwritten by inner `for` loop target | @@ -90,7 +89,7 @@ redefined_loop_name.py:67:5: PLW2901 `for` loop variable `i` overwritten by assi 66 | i = typing.cast(int, i) 67 | i = 5 # error | ^ PLW2901 -68 | +68 | 69 | # For -> augmented assignment | @@ -100,7 +99,7 @@ redefined_loop_name.py:71:5: PLW2901 `for` loop variable `i` overwritten by assi 70 | for i in []: 71 | i += 5 # error | ^ PLW2901 -72 | +72 | 73 | # For -> annotated assignment | @@ -110,7 +109,7 @@ redefined_loop_name.py:75:5: PLW2901 `for` loop variable `i` overwritten by assi 74 | for i in []: 75 | i: int = 5 # error | ^ PLW2901 -76 | +76 | 77 | # For -> annotated assignment without value | @@ -183,7 +182,7 @@ redefined_loop_name.py:137:13: PLW2901 `for` loop variable `i` overwritten by as 136 | for i in []: # no error 137 | i = 2 # error | ^ PLW2901 -138 | +138 | 139 | # For -> class definition -> for -> for | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap index 1ac8bee6ed..407fa4b92d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3201_bad_dunder_method_name.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- bad_dunder_method_name.py:5:9: PLW3201 Dunder method `_init_` has no special meaning in Python 3 | @@ -13,7 +12,7 @@ bad_dunder_method_name.py:5:9: PLW3201 Dunder method `_init_` has no special mea bad_dunder_method_name.py:8:9: PLW3201 Dunder method `__hello__` has no special meaning in Python 3 | 6 | pass -7 | +7 | 8 | def __hello__(self): # [bad-dunder-name] | ^^^^^^^^^ PLW3201 9 | print("hello") @@ -22,7 +21,7 @@ bad_dunder_method_name.py:8:9: PLW3201 Dunder method `__hello__` has no special bad_dunder_method_name.py:11:9: PLW3201 Dunder method `__init_` has no special meaning in Python 3 | 9 | print("hello") -10 | +10 | 11 | def __init_(self): # [bad-dunder-name] | ^^^^^^^ PLW3201 12 | # author likely unintentionally misspelled the correct init dunder. @@ -32,7 +31,7 @@ bad_dunder_method_name.py:11:9: PLW3201 Dunder method `__init_` has no special m bad_dunder_method_name.py:15:9: PLW3201 Dunder method `_init_` has no special meaning in Python 3 | 13 | pass -14 | +14 | 15 | def _init_(self): # [bad-dunder-name] | ^^^^^^ PLW3201 16 | # author likely unintentionally misspelled the correct init dunder. @@ -42,7 +41,7 @@ bad_dunder_method_name.py:15:9: PLW3201 Dunder method `_init_` has no special me bad_dunder_method_name.py:19:9: PLW3201 Dunder method `___neg__` has no special meaning in Python 3 | 17 | pass -18 | +18 | 19 | def ___neg__(self): # [bad-dunder-name] | ^^^^^^^^ PLW3201 20 | # author likely accidentally added an additional `_` @@ -52,7 +51,7 @@ bad_dunder_method_name.py:19:9: PLW3201 Dunder method `___neg__` has no special bad_dunder_method_name.py:23:9: PLW3201 Dunder method `__inv__` has no special meaning in Python 3 | 21 | pass -22 | +22 | 23 | def __inv__(self): # [bad-dunder-name] | ^^^^^^^ PLW3201 24 | # author likely meant to call the invert dunder method 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 b4043cd22f..af86b45d1d 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened | @@ -148,7 +147,7 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened 8 | max(1, max(2, max(3, 4))) 9 | max(1, foo("a", "b"), max(3, 4)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW3301 -10 | +10 | 11 | # These should not trigger; we do not flag cases with keyword args. | = help: Flatten nested `max` calls @@ -169,7 +168,7 @@ nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened 14 | # This will still trigger, to merge the calls without keyword args. 15 | min(1, min(2, 3, key=test), min(4, 5)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW3301 -16 | +16 | 17 | # Don't provide a fix if there are comments within the call. | = help: Flatten nested `min` calls @@ -192,7 +191,7 @@ nested_min_max.py:18:1: PLW3301 Nested `min` calls can be flattened 20 | | min(2, 3), 21 | | ) | |_^ PLW3301 -22 | +22 | 23 | # Handle iterable expressions. | = help: Flatten nested `min` calls @@ -264,7 +263,7 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened 26 | max(1, max(a)) 27 | max(1, max(i for i in range(10))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW3301 -28 | +28 | 29 | tuples_list = [ | = help: Flatten nested `max` calls @@ -284,7 +283,7 @@ nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened 40 | # Starred argument should be copied as it is. 41 | max(1, max(*a)) | ^^^^^^^^^^^^^^^ PLW3301 -42 | +42 | 43 | import builtins | = help: Flatten nested `max` calls @@ -326,7 +325,7 @@ nested_min_max.py:48:16: PLW3301 [*] Nested `max` calls can be flattened 50 | | len("Done!"), 51 | | ) | |_^ PLW3301 -52 | +52 | 53 | # OK | = help: Flatten nested `max` calls diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap index f857130221..6d6a223c11 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__allow_magic_value_types.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- magic_value_comparison.py:56:12: PLR2004 Magic value used in comparison, consider replacing `-2.0` with a constant variable | 54 | pass -55 | +55 | 56 | if argc != -2.0: # [magic-value-comparison] | ^^^^ PLR2004 57 | pass @@ -14,7 +13,7 @@ magic_value_comparison.py:56:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:59:12: PLR2004 Magic value used in comparison, consider replacing `+2.0` with a constant variable | 57 | pass -58 | +58 | 59 | if argc != +2.0: # [magic-value-comparison] | ^^^^ PLR2004 60 | pass @@ -23,7 +22,7 @@ magic_value_comparison.py:59:12: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:74:22: PLR2004 Magic value used in comparison, consider replacing `"Hunter2"` with a constant variable | 72 | pass -73 | +73 | 74 | if input_password == "Hunter2": # correct | ^^^^^^^^^ PLR2004 75 | pass @@ -32,7 +31,7 @@ magic_value_comparison.py:74:22: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:80:21: PLR2004 Magic value used in comparison, consider replacing `3.141592653589793238` with a constant variable | 78 | pi_estimation = 3.14 -79 | +79 | 80 | if pi_estimation == 3.141592653589793238: # [magic-value-comparison] | ^^^^^^^^^^^^^^^^^^^^ PLR2004 81 | pass @@ -41,7 +40,7 @@ magic_value_comparison.py:80:21: PLR2004 Magic value used in comparison, conside magic_value_comparison.py:92:18: PLR2004 Magic value used in comparison, consider replacing `b"something"` with a constant variable | 90 | user_input = b"Hello, There!" -91 | +91 | 92 | if user_input == b"something": # correct | ^^^^^^^^^^^^ PLR2004 93 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap index 6a195c7775..2391a6f9d4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__continue_in_finally.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- continue_in_finally.py:5:9: PLE0116 `continue` not supported inside `finally` clause | @@ -8,7 +7,7 @@ continue_in_finally.py:5:9: PLE0116 `continue` not supported inside `finally` cl 4 | finally: 5 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -6 | +6 | 7 | while True: | @@ -27,7 +26,7 @@ continue_in_finally.py:26:17: PLE0116 `continue` not supported inside `finally` 25 | case "aa": 26 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -27 | +27 | 28 | while True: | @@ -37,7 +36,7 @@ continue_in_finally.py:33:13: PLE0116 `continue` not supported inside `finally` 32 | with "aa" as f: 33 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -34 | +34 | 35 | while True: | @@ -56,7 +55,7 @@ continue_in_finally.py:41:9: PLE0116 `continue` not supported inside `finally` c 40 | continue # [continue-in-finally] 41 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -42 | +42 | 43 | def test(): | @@ -74,7 +73,7 @@ continue_in_finally.py:56:9: PLE0116 `continue` not supported inside `finally` c 55 | finally: 56 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -57 | +57 | 58 | def test(): | @@ -84,7 +83,7 @@ continue_in_finally.py:69:9: PLE0116 `continue` not supported inside `finally` c 68 | continue 69 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -70 | +70 | 71 | while True: | @@ -94,7 +93,7 @@ continue_in_finally.py:74:13: PLE0116 `continue` not supported inside `finally` 73 | else: 74 | continue # [continue-in-finally] | ^^^^^^^^ PLE0116 -75 | +75 | 76 | def test(): | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap index 10c8978d84..bcfd72f36a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_branches.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- too_many_branches_params.py:6:5: PLR0912 Too many branches (2 > 1) | @@ -13,7 +12,7 @@ too_many_branches_params.py:6:5: PLR0912 Too many branches (2 > 1) too_many_branches_params.py:15:9: PLR0912 Too many branches (2 > 1) | 13 | return -14 | +14 | 15 | def i(x): | ^ PLR0912 16 | if x: diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLR1714_repeated_equality_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLR1714_repeated_equality_comparison.py.snap index 02c5e92cb7..8c988f02f7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLR1714_repeated_equality_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLR1714_repeated_equality_comparison.py.snap @@ -6,7 +6,7 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa 1 | # Errors. 2 | foo == "a" or foo == "b" | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -3 | +3 | 4 | foo != "a" and foo != "b" | = help: Merge multiple comparisons @@ -22,10 +22,10 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in {"a", "b"}`. | 2 | foo == "a" or foo == "b" -3 | +3 | 4 | foo != "a" and foo != "b" | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -5 | +5 | 6 | foo == "a" or foo == "b" or foo == "c" | = help: Merge multiple comparisons @@ -43,10 +43,10 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {"a", "b", "c"}`. | 4 | foo != "a" and foo != "b" -5 | +5 | 6 | foo == "a" or foo == "b" or foo == "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -7 | +7 | 8 | foo != "a" and foo != "b" and foo != "c" | = help: Merge multiple comparisons @@ -64,10 +64,10 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in {"a", "b", "c"}`. | 6 | foo == "a" or foo == "b" or foo == "c" - 7 | + 7 | 8 | foo != "a" and foo != "b" and foo != "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 - 9 | + 9 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. | = help: Merge multiple comparisons @@ -85,10 +85,10 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (a, "b", 3)`. Use a `set` if the elements are hashable. | 8 | foo != "a" and foo != "b" and foo != "c" - 9 | + 9 | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -11 | +11 | 12 | "a" == foo or "b" == foo or "c" == foo | = help: Merge multiple comparisons @@ -106,10 +106,10 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {"a", "b", "c"}`. | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. -11 | +11 | 12 | "a" == foo or "b" == foo or "c" == foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -13 | +13 | 14 | "a" != foo and "b" != foo and "c" != foo | = help: Merge multiple comparisons @@ -127,10 +127,10 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in {"a", "b", "c"}`. | 12 | "a" == foo or "b" == foo or "c" == foo -13 | +13 | 14 | "a" != foo and "b" != foo and "c" != foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -15 | +15 | 16 | "a" == foo or foo == "b" or "c" == foo | = help: Merge multiple comparisons @@ -148,10 +148,10 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {"a", "b", "c"}`. | 14 | "a" != foo and "b" != foo and "c" != foo -15 | +15 | 16 | "a" == foo or foo == "b" or "c" == foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -17 | +17 | 18 | foo == bar or baz == foo or qux == foo | = help: Merge multiple comparisons @@ -169,10 +169,10 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (bar, baz, qux)`. Use a `set` if the elements are hashable. | 16 | "a" == foo or foo == "b" or "c" == foo -17 | +17 | 18 | foo == bar or baz == foo or qux == foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -19 | +19 | 20 | foo == "a" or "b" == foo or foo == "c" | = help: Merge multiple comparisons @@ -190,10 +190,10 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {"a", "b", "c"}`. | 18 | foo == bar or baz == foo or qux == foo -19 | +19 | 20 | foo == "a" or "b" == foo or foo == "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -21 | +21 | 22 | foo != "a" and "b" != foo and foo != "c" | = help: Merge multiple comparisons @@ -211,10 +211,10 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in {"a", "b", "c"}`. | 20 | foo == "a" or "b" == foo or foo == "c" -21 | +21 | 22 | foo != "a" and "b" != foo and foo != "c" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -23 | +23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | = help: Merge multiple comparisons @@ -232,10 +232,10 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {"a", "b"}`. | 22 | foo != "a" and "b" != foo and foo != "c" -23 | +23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -25 | +25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | = help: Merge multiple comparisons @@ -253,10 +253,10 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `bar in {"c", "d"}`. | 22 | foo != "a" and "b" != foo and foo != "c" -23 | +23 | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -25 | +25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | = help: Merge multiple comparisons @@ -274,10 +274,10 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comparisons: `foo.bar in {"a", "b"}`. | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets -25 | +25 | 26 | foo.bar == "a" or foo.bar == "b" # Attributes. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -27 | +27 | 28 | # OK | = help: Merge multiple comparisons @@ -295,10 +295,10 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple comparisons: `bar in {"c", "d"}`. | 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets -60 | +60 | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -62 | +62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | = help: Merge multiple comparisons @@ -316,10 +316,10 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {"a", "b"}`. | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets -62 | +62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -64 | +64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | = help: Merge multiple comparisons @@ -337,10 +337,10 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple comparisons: `bar not in {"c", "d"}`. | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets -62 | +62 | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -64 | +64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | = help: Merge multiple comparisons @@ -358,10 +358,10 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple comparisons: `bar not in {"c", "d"}`. | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets -64 | +64 | 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets | ^^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -66 | +66 | 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets | = help: Merge multiple comparisons @@ -379,10 +379,10 @@ repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple com repeated_equality_comparison.py:69:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {1, True}`. | 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets -68 | +68 | 69 | foo == 1 or foo == True # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -70 | +70 | 71 | foo == 1 or foo == 1.0 # Different types, same hashed value | = help: Merge multiple comparisons @@ -400,10 +400,10 @@ repeated_equality_comparison.py:69:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:71:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {1, 1.0}`. | 69 | foo == 1 or foo == True # Different types, same hashed value -70 | +70 | 71 | foo == 1 or foo == 1.0 # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -72 | +72 | 73 | foo == False or foo == 0 # Different types, same hashed value | = help: Merge multiple comparisons @@ -421,10 +421,10 @@ repeated_equality_comparison.py:71:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:73:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {False, 0}`. | 71 | foo == 1 or foo == 1.0 # Different types, same hashed value -72 | +72 | 73 | foo == False or foo == 0 # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 -74 | +74 | 75 | foo == 0.0 or foo == 0j # Different types, same hashed value | = help: Merge multiple comparisons @@ -441,7 +441,7 @@ repeated_equality_comparison.py:73:1: PLR1714 [*] Consider merging multiple comp repeated_equality_comparison.py:75:1: PLR1714 [*] Consider merging multiple comparisons: `foo in {0.0, 0j}`. | 73 | foo == False or foo == 0 # Different types, same hashed value -74 | +74 | 75 | foo == 0.0 or foo == 0j # Different types, same hashed value | ^^^^^^^^^^^^^^^^^^^^^^^ PLR1714 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLW1508_invalid_envvar_default.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLW1508_invalid_envvar_default.py.snap index 7bc7aeaa45..0ad2917d0c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLW1508_invalid_envvar_default.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__preview__PLW1508_invalid_envvar_default.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs -snapshot_kind: text --- invalid_envvar_default.py:3:29: PLW1508 Invalid type for environment variable default; expected `str` or `None` | 1 | import os -2 | +2 | 3 | tempVar = os.getenv("TEST", 12) # [invalid-envvar-default] | ^^ PLW1508 4 | goodVar = os.getenv("TESTING", None) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap index 7e43934f1f..6eff6362b5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__too_many_public_methods.snap @@ -5,37 +5,37 @@ too_many_public_methods.py:4:1: PLR0904 Too many public methods (10 > 7) | 4 | / class Everything: 5 | | foo = 1 - 6 | | + 6 | | 7 | | def __init__(self): 8 | | pass - 9 | | + 9 | | 10 | | def _private(self): 11 | | pass -12 | | +12 | | 13 | | def method1(self): 14 | | pass -15 | | +15 | | 16 | | def method2(self): 17 | | pass -18 | | +18 | | 19 | | def method3(self): 20 | | pass -21 | | +21 | | 22 | | def method4(self): 23 | | pass -24 | | +24 | | 25 | | def method5(self): 26 | | pass -27 | | +27 | | 28 | | def method6(self): 29 | | pass -30 | | +30 | | 31 | | def method7(self): 32 | | pass -33 | | +33 | | 34 | | def method8(self): 35 | | pass -36 | | +36 | | 37 | | def method9(self): 38 | | pass | |____________^ PLR0904 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 92cfb8e021..e0964e0a04 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP001.py:2:5: UP001 [*] `__metaclass__ = type` is implied | @@ -23,7 +22,7 @@ UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied 5 | class B: 6 | __metaclass__ = type | ^^^^^^^^^^^^^^^^^^^^ UP001 -7 | +7 | 8 | def __init__(self) -> None: | = help: Remove `__metaclass__ = type` 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 000e7e2b2e..d11e176201 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP003.py:1:1: UP003 [*] Use `str` instead of `type(...)` | @@ -82,7 +81,7 @@ UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` 4 | type(0.0) 5 | type(0j) | ^^^^^^^^ UP003 -6 | +6 | 7 | # OK | = help: Replace `type(...)` with `complex` 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 e042b8c1ff..7c4eabfa7b 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP004.py:5:9: UP004 [*] Class `A` inherits from `object` | @@ -494,7 +493,7 @@ UP004.py:146:9: UP004 [*] Class `A` inherits from `object` UP004.py:159:15: UP004 [*] Class `Unusual` inherits from `object` | 157 | import builtins -158 | +158 | 159 | class Unusual(builtins.object): | ^^^^^^^^^^^^^^^ UP004 160 | ... 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 7084576892..496c05b804 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP009_0.py:1:1: UP009 [*] UTF-8 encoding declaration is unnecessary | 1 | # coding=utf8 | ^^^^^^^^^^^^^ UP009 -2 | +2 | 3 | print("Hello world") | = help: Remove unnecessary coding comment 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 62c16d74a6..5b64115e35 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP009_1.py:2:1: UP009 [*] UTF-8 encoding declaration is unnecessary | 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- | ^^^^^^^^^^^^^^^^^^^^^^^ UP009 -3 | +3 | 4 | print('Hello world') | = help: Remove unnecessary coding comment 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 3b081afd9d..89d50cf2f4 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version | @@ -98,7 +97,7 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target 5 | from __future__ import print_function, generator_stop 6 | from __future__ import invalid_module, generators | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP010 -7 | +7 | 8 | if True: | = help: Remove unnecessary `__future__` import @@ -137,7 +136,7 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target 9 | from __future__ import generator_stop 10 | from __future__ import generators | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP010 -11 | +11 | 12 | if True: | = help: Remove unnecessary `__future__` import 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 0e03e843a1..09bb75d3d8 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 @@ -6,7 +6,7 @@ UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 4 | # dict literal 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -6 | +6 | 7 | # dict call | = help: Convert `MyType` to class syntax @@ -28,7 +28,7 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 7 | # dict call 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 - 9 | + 9 | 10 | # kwargs | = help: Convert `MyType` to class syntax @@ -50,7 +50,7 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 10 | # kwargs 11 | MyType = TypedDict("MyType", a=int, b=str) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -12 | +12 | 13 | # Empty TypedDict | = help: Convert `MyType` to class syntax @@ -72,7 +72,7 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 13 | # Empty TypedDict 14 | MyType = TypedDict("MyType") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -15 | +15 | 16 | # Literal values | = help: Convert `MyType` to class syntax @@ -114,7 +114,7 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 17 | MyType = TypedDict("MyType", {"a": "hello"}) 18 | MyType = TypedDict("MyType", a="hello") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -19 | +19 | 20 | # NotRequired | = help: Convert `MyType` to class syntax @@ -135,7 +135,7 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 20 | # NotRequired 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -22 | +22 | 23 | # total | = help: Convert `MyType` to class syntax @@ -156,7 +156,7 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 23 | # total 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -25 | +25 | 26 | # using Literal type | = help: Convert `MyType` to class syntax @@ -178,7 +178,7 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 26 | # using Literal type 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -28 | +28 | 29 | # using namespace TypedDict | = help: Convert `MyType` to class syntax @@ -199,7 +199,7 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 29 | # using namespace TypedDict 30 | MyType = typing.TypedDict("MyType", {"key": int}) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -31 | +31 | 32 | # invalid identifiers (OK) | = help: Convert `MyType` to class syntax @@ -220,7 +220,7 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 39 | # Empty dict literal 40 | MyType = TypedDict("MyType", {}) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -41 | +41 | 42 | # Empty dict call | = help: Convert `MyType` to class syntax @@ -241,7 +241,7 @@ UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 42 | # Empty dict call 43 | MyType = TypedDict("MyType", dict()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP013 -44 | +44 | 45 | # Unsafe fix if comments are present | = help: Convert `MyType` to class syntax 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 9a049ab22a..24aec45ab8 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 @@ -6,7 +6,7 @@ UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 4 | # with complex annotations 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP014 -6 | +6 | 7 | # with namespace | = help: Convert `MyType` to class syntax @@ -28,7 +28,7 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 7 | # with namespace 8 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP014 - 9 | + 9 | 10 | # invalid identifiers (OK) | = help: Convert `MyType` to class syntax @@ -50,7 +50,7 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 13 | # no fields 14 | MyType = typing.NamedTuple("MyType") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP014 -15 | +15 | 16 | # empty fields | = help: Convert `MyType` to class syntax @@ -71,7 +71,7 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 16 | # empty fields 17 | MyType = typing.NamedTuple("MyType", []) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP014 -18 | +18 | 19 | # keywords | = help: Convert `MyType` to class syntax @@ -92,7 +92,7 @@ UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 19 | # keywords 20 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP014 -21 | +21 | 22 | # unfixable | = help: Convert `MyType` to class syntax 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 40e6e2a2b2..57b1ab13c8 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP015.py:1:1: UP015 [*] Unnecessary open mode parameters | @@ -166,7 +165,7 @@ UP015.py:9:1: UP015 [*] Unnecessary open mode parameters, use "w" 8 | open("f", "wt") 9 | open("f", "tw") | ^^^^^^^^^^^^^^^ UP015 -10 | +10 | 11 | with open("foo", "U") as f: | = help: Replace with "w" @@ -184,7 +183,7 @@ UP015.py:9:1: UP015 [*] Unnecessary open mode parameters, use "w" UP015.py:11:6: UP015 [*] Unnecessary open mode parameters | 9 | open("f", "tw") -10 | +10 | 11 | with open("foo", "U") as f: | ^^^^^^^^^^^^^^^^ UP015 12 | pass @@ -351,7 +350,7 @@ UP015.py:25:6: UP015 [*] Unnecessary open mode parameters, use "w" UP015.py:28:1: UP015 [*] Unnecessary open mode parameters | 26 | pass -27 | +27 | 28 | open(f("a", "b", "c"), "U") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 29 | open(f("a", "b", "c"), "Ub") @@ -373,7 +372,7 @@ UP015.py:29:1: UP015 [*] Unnecessary open mode parameters, use "rb" 28 | open(f("a", "b", "c"), "U") 29 | open(f("a", "b", "c"), "Ub") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 -30 | +30 | 31 | with open(f("a", "b", "c"), "U") as f: | = help: Replace with "rb" @@ -391,7 +390,7 @@ UP015.py:29:1: UP015 [*] Unnecessary open mode parameters, use "rb" UP015.py:31:6: UP015 [*] Unnecessary open mode parameters | 29 | open(f("a", "b", "c"), "Ub") -30 | +30 | 31 | with open(f("a", "b", "c"), "U") as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 32 | pass @@ -432,7 +431,7 @@ UP015.py:33:6: UP015 [*] Unnecessary open mode parameters, use "rb" UP015.py:36:6: UP015 [*] Unnecessary open mode parameters | 34 | pass -35 | +35 | 36 | with open("foo", "U") as fa, open("bar", "U") as fb: | ^^^^^^^^^^^^^^^^ UP015 37 | pass @@ -453,7 +452,7 @@ UP015.py:36:6: UP015 [*] Unnecessary open mode parameters UP015.py:36:30: UP015 [*] Unnecessary open mode parameters | 34 | pass -35 | +35 | 36 | with open("foo", "U") as fa, open("bar", "U") as fb: | ^^^^^^^^^^^^^^^^ UP015 37 | pass @@ -514,7 +513,7 @@ UP015.py:38:31: UP015 [*] Unnecessary open mode parameters, use "rb" UP015.py:41:1: UP015 [*] Unnecessary open mode parameters | 39 | pass -40 | +40 | 41 | open("foo", mode="U") | ^^^^^^^^^^^^^^^^^^^^^ UP015 42 | open(name="foo", mode="U") @@ -557,7 +556,7 @@ UP015.py:43:1: UP015 [*] Unnecessary open mode parameters 42 | open(name="foo", mode="U") 43 | open(mode="U", name="foo") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 -44 | +44 | 45 | with open("foo", mode="U") as f: | = help: Remove open mode parameters @@ -575,7 +574,7 @@ UP015.py:43:1: UP015 [*] Unnecessary open mode parameters UP015.py:45:6: UP015 [*] Unnecessary open mode parameters | 43 | open(mode="U", name="foo") -44 | +44 | 45 | with open("foo", mode="U") as f: | ^^^^^^^^^^^^^^^^^^^^^ UP015 46 | pass @@ -637,7 +636,7 @@ UP015.py:49:6: UP015 [*] Unnecessary open mode parameters UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use "rb" | 50 | pass -51 | +51 | 52 | open("foo", mode="Ub") | ^^^^^^^^^^^^^^^^^^^^^^ UP015 53 | open(name="foo", mode="Ub") @@ -680,7 +679,7 @@ UP015.py:54:1: UP015 [*] Unnecessary open mode parameters, use "rb" 53 | open(name="foo", mode="Ub") 54 | open(mode="Ub", name="foo") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 -55 | +55 | 56 | with open("foo", mode="Ub") as f: | = help: Replace with "rb" @@ -698,7 +697,7 @@ UP015.py:54:1: UP015 [*] Unnecessary open mode parameters, use "rb" UP015.py:56:6: UP015 [*] Unnecessary open mode parameters, use "rb" | 54 | open(mode="Ub", name="foo") -55 | +55 | 56 | with open("foo", mode="Ub") as f: | ^^^^^^^^^^^^^^^^^^^^^^ UP015 57 | pass @@ -760,7 +759,7 @@ UP015.py:60:6: UP015 [*] Unnecessary open mode parameters, use "rb" UP015.py:63:1: UP015 [*] Unnecessary open mode parameters | 61 | pass -62 | +62 | 63 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 64 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -824,7 +823,7 @@ UP015.py:66:1: UP015 [*] Unnecessary open mode parameters 65 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) 66 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 -67 | +67 | 68 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) | = help: Remove open mode parameters @@ -842,7 +841,7 @@ UP015.py:66:1: UP015 [*] Unnecessary open mode parameters UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use "rb" | 66 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) -67 | +67 | 68 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 69 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -906,7 +905,7 @@ UP015.py:71:1: UP015 [*] Unnecessary open mode parameters, use "rb" 70 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) 71 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 -72 | +72 | 73 | import aiofiles | = help: Replace with "rb" @@ -924,7 +923,7 @@ UP015.py:71:1: UP015 [*] Unnecessary open mode parameters, use "rb" UP015.py:75:1: UP015 [*] Unnecessary open mode parameters | 73 | import aiofiles -74 | +74 | 75 | aiofiles.open("foo", "U") | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 76 | aiofiles.open("foo", "r") @@ -967,7 +966,7 @@ UP015.py:77:1: UP015 [*] Unnecessary open mode parameters 76 | aiofiles.open("foo", "r") 77 | aiofiles.open("foo", mode="r") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP015 -78 | +78 | 79 | open("foo", "r+") | = help: Remove open mode parameters 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 c6a6796bea..1bf6316ea1 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP018.py:37:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | @@ -285,7 +284,7 @@ UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 51 | bool(True) 52 | bool(False) | ^^^^^^^^^^^ UP018 -53 | +53 | 54 | # These become a literal but retain parentheses | = help: Replace with boolean literal @@ -305,7 +304,7 @@ UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 54 | # These become a literal but retain parentheses 55 | int(1).denominator | ^^^^^^ UP018 -56 | +56 | 57 | # These too are literals in spirit | = help: Replace with integer literal 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 ed65106f25..314d5aa499 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP020.py:3:6: UP020 [*] Use builtin `open` | 1 | import io -2 | +2 | 3 | with io.open("f.txt", mode="r", buffering=-1, **kwargs) as f: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP020 4 | print(f.read()) @@ -24,7 +23,7 @@ UP020.py:3:6: UP020 [*] Use builtin `open` UP020.py:8:6: UP020 [*] Use builtin `open` | 6 | from io import open -7 | +7 | 8 | with open("f.txt") as f: | ^^^^^^^^^^^^^ UP020 9 | print(f.read()) 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 70eb08d6ae..9d7e2095ad 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` | @@ -48,7 +47,7 @@ UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` 6 | subprocess.run(["foo"], universal_newlines=True, text=True) 7 | run(["foo"], universal_newlines=True, check=False) | ^^^^^^^^^^^^^^^^^^ UP021 -8 | +8 | 9 | # OK | = help: Replace with `text` keyword argument 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 670cbbaee6..990936ee28 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 @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP022.py:4:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 2 | import subprocess -3 | +3 | 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP022 -5 | +5 | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | = help: Replace with `capture_output` keyword argument @@ -26,10 +25,10 @@ UP022.py:4:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -5 | +5 | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP022 -7 | +7 | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) | = help: Replace with `capture_output` keyword argument @@ -47,10 +46,10 @@ UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - 7 | + 7 | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP022 - 9 | + 9 | 10 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument @@ -68,13 +67,13 @@ UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) - 9 | + 9 | 10 | output = subprocess.run( | __________^ 11 | | ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE 12 | | ) | |_^ UP022 -13 | +13 | 14 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument @@ -92,13 +91,13 @@ UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 12 | ) -13 | +13 | 14 | output = subprocess.run( | __________^ 15 | | ["foo"], stderr=subprocess.PIPE, check=True, stdout=subprocess.PIPE 16 | | ) | |_^ UP022 -17 | +17 | 18 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument @@ -116,7 +115,7 @@ UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 16 | ) -17 | +17 | 18 | output = subprocess.run( | __________^ 19 | | ["foo"], @@ -128,7 +127,7 @@ UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std 25 | | close_fds=True, 26 | | ) | |_^ UP022 -27 | +27 | 28 | if output: | = help: Replace with `capture_output` keyword argument @@ -158,7 +157,7 @@ UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `std 35 | | encoding="utf-8", 36 | | ) | |_____^ UP022 -37 | +37 | 38 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument @@ -178,13 +177,13 @@ UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `std UP022.py:38:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 36 | ) -37 | +37 | 38 | output = subprocess.run( | __________^ 39 | | ["foo"], stdout=subprocess.PIPE, capture_output=True, stderr=subprocess.PIPE 40 | | ) | |_^ UP022 -41 | +41 | 42 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument @@ -192,13 +191,13 @@ UP022.py:38:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` UP022.py:42:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 40 | ) -41 | +41 | 42 | output = subprocess.run( | __________^ 43 | | ["foo"], stdout=subprocess.PIPE, capture_output=False, stderr=subprocess.PIPE 44 | | ) | |_^ UP022 -45 | +45 | 46 | output = subprocess.run( | = help: Replace with `capture_output` keyword argument @@ -206,13 +205,13 @@ UP022.py:42:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` UP022.py:46:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 44 | ) -45 | +45 | 46 | output = subprocess.run( | __________^ 47 | | ["foo"], capture_output=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE 48 | | ) | |_^ UP022 -49 | +49 | 50 | # OK | = help: Replace with `capture_output` keyword argument diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 319ac21850..33e1699fe3 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | @@ -25,7 +24,7 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 2 | from xml.etree.cElementTree import XML, Element, SubElement 3 | import xml.etree.cElementTree as ET | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023 -4 | +4 | 5 | # Weird spacing should not cause issues. | = help: Replace with `ElementTree` @@ -64,7 +63,7 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 6 | from xml.etree.cElementTree import XML 7 | import xml.etree.cElementTree as ET | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023 -8 | +8 | 9 | # Multi line imports should also work fine. | = help: Replace with `ElementTree` @@ -129,7 +128,7 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 16 | import xml.etree.cElementTree as ET 17 | from xml.etree import cElementTree as CET | ^^^^^^^^^^^^^^^^^^^ UP023 -18 | +18 | 19 | from xml.etree import cElementTree as ET | = help: Replace with `ElementTree` @@ -147,10 +146,10 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 17 | from xml.etree import cElementTree as CET -18 | +18 | 19 | from xml.etree import cElementTree as ET | ^^^^^^^^^^^^^^^^^^ UP023 -20 | +20 | 21 | import contextlib, xml.etree.cElementTree as ET | = help: Replace with `ElementTree` @@ -168,10 +167,10 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 19 | from xml.etree import cElementTree as ET -20 | +20 | 21 | import contextlib, xml.etree.cElementTree as ET | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023 -22 | +22 | 23 | # This should fix the second, but not the first invocation. | = help: Replace with `ElementTree` @@ -191,7 +190,7 @@ UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 23 | # This should fix the second, but not the first invocation. 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023 -25 | +25 | 26 | # The below items should NOT be changed. | = help: Replace with `ElementTree` 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 31aebee5a0..b6e358f62f 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP024_2.py:10:7: UP024 [*] Replace aliased errors with `OSError` | @@ -49,7 +48,7 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` 11 | raise mmap.error 12 | raise select.error | ^^^^^^^^^^^^ UP024 -13 | +13 | 14 | raise socket.error() | = help: Replace `select.error` with builtin `OSError` @@ -67,7 +66,7 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` | 12 | raise select.error -13 | +13 | 14 | raise socket.error() | ^^^^^^^^^^^^ UP024 15 | raise mmap.error(1) @@ -110,7 +109,7 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` 15 | raise mmap.error(1) 16 | raise select.error(1, 2) | ^^^^^^^^^^^^ UP024 -17 | +17 | 18 | raise socket.error( | = help: Replace `select.error` with builtin `OSError` @@ -128,7 +127,7 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` | 16 | raise select.error(1, 2) -17 | +17 | 18 | raise socket.error( | ^^^^^^^^^^^^ UP024 19 | 1, @@ -151,7 +150,7 @@ UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` 24 | from mmap import error 25 | raise error | ^^^^^ UP024 -26 | +26 | 27 | from socket import error | = help: Replace `error` with builtin `OSError` @@ -171,7 +170,7 @@ UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` 27 | from socket import error 28 | raise error(1) | ^^^^^ UP024 -29 | +29 | 30 | from select import error | = help: Replace `error` with builtin `OSError` @@ -191,7 +190,7 @@ UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` 30 | from select import error 31 | raise error(1, 2) | ^^^^^ UP024 -32 | +32 | 33 | # Testing the names | = help: Replace `error` with builtin `OSError` @@ -252,7 +251,7 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` 35 | raise IOError 36 | raise WindowsError | ^^^^^^^^^^^^ UP024 -37 | +37 | 38 | raise EnvironmentError() | = help: Replace `WindowsError` with builtin `OSError` @@ -270,7 +269,7 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` | 36 | raise WindowsError -37 | +37 | 38 | raise EnvironmentError() | ^^^^^^^^^^^^^^^^ UP024 39 | raise IOError(1) @@ -313,7 +312,7 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` 39 | raise IOError(1) 40 | raise WindowsError(1, 2) | ^^^^^^^^^^^^ UP024 -41 | +41 | 42 | raise EnvironmentError( | = help: Replace `WindowsError` with builtin `OSError` @@ -331,7 +330,7 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` | 40 | raise WindowsError(1, 2) -41 | +41 | 42 | raise EnvironmentError( | ^^^^^^^^^^^^^^^^ UP024 43 | 1, @@ -352,7 +351,7 @@ UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` | 46 | ) -47 | +47 | 48 | raise WindowsError | ^^^^^^^^^^^^ UP024 49 | raise EnvironmentError(1) 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 92a7f3e261..916977bfed 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP025.py:1:1: UP025 [*] Remove unicode literals from strings | 1 | u"Hello" | ^^^^^^^^ UP025 -2 | +2 | 3 | x = u"Hello" # UP025 | = help: Remove unicode prefix @@ -21,10 +20,10 @@ UP025.py:1:1: UP025 [*] Remove unicode literals from strings UP025.py:3:5: UP025 [*] Remove unicode literals from strings | 1 | u"Hello" -2 | +2 | 3 | x = u"Hello" # UP025 | ^^^^^^^^ UP025 -4 | +4 | 5 | u'world' # UP025 | = help: Remove unicode prefix @@ -41,10 +40,10 @@ UP025.py:3:5: UP025 [*] Remove unicode literals from strings UP025.py:5:1: UP025 [*] Remove unicode literals from strings | 3 | x = u"Hello" # UP025 -4 | +4 | 5 | u'world' # UP025 | ^^^^^^^^ UP025 -6 | +6 | 7 | print(u"Hello") # UP025 | = help: Remove unicode prefix @@ -62,10 +61,10 @@ UP025.py:5:1: UP025 [*] Remove unicode literals from strings UP025.py:7:7: UP025 [*] Remove unicode literals from strings | 5 | u'world' # UP025 -6 | +6 | 7 | print(u"Hello") # UP025 | ^^^^^^^^ UP025 -8 | +8 | 9 | print(u'world') # UP025 | = help: Remove unicode prefix @@ -83,10 +82,10 @@ UP025.py:7:7: UP025 [*] Remove unicode literals from strings UP025.py:9:7: UP025 [*] Remove unicode literals from strings | 7 | print(u"Hello") # UP025 - 8 | + 8 | 9 | print(u'world') # UP025 | ^^^^^^^^ UP025 -10 | +10 | 11 | import foo | = help: Remove unicode prefix @@ -104,10 +103,10 @@ UP025.py:9:7: UP025 [*] Remove unicode literals from strings UP025.py:13:5: UP025 [*] Remove unicode literals from strings | 11 | import foo -12 | +12 | 13 | foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 | ^^^^^^^^ UP025 -14 | +14 | 15 | # Retain quotes when fixing. | = help: Remove unicode prefix @@ -125,10 +124,10 @@ UP025.py:13:5: UP025 [*] Remove unicode literals from strings UP025.py:13:15: UP025 [*] Remove unicode literals from strings | 11 | import foo -12 | +12 | 13 | foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 | ^^^^^^^^ UP025 -14 | +14 | 15 | # Retain quotes when fixing. | = help: Remove unicode prefix @@ -146,10 +145,10 @@ UP025.py:13:15: UP025 [*] Remove unicode literals from strings UP025.py:13:27: UP025 [*] Remove unicode literals from strings | 11 | import foo -12 | +12 | 13 | foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 | ^^^^^^^^ UP025 -14 | +14 | 15 | # Retain quotes when fixing. | = help: Remove unicode prefix @@ -167,10 +166,10 @@ UP025.py:13:27: UP025 [*] Remove unicode literals from strings UP025.py:13:39: UP025 [*] Remove unicode literals from strings | 11 | import foo -12 | +12 | 13 | foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 | ^^^^^^^^ UP025 -14 | +14 | 15 | # Retain quotes when fixing. | = help: Remove unicode prefix @@ -252,7 +251,7 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings 18 | x = u'''hello''' # UP025 19 | x = u'Hello "World"' # UP025 | ^^^^^^^^^^^^^^^^ UP025 -20 | +20 | 21 | u = "Hello" # OK | = help: Remove unicode prefix @@ -270,7 +269,7 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings UP025.py:27:7: UP025 [*] Remove unicode literals from strings | 25 | return"Hello" # OK -26 | +26 | 27 | f"foo"u"bar" # OK | ^^^^^^ UP025 28 | f"foo" u"bar" # OK 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 a852bdc242..2789248a3c 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call | @@ -45,7 +44,7 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call 3 | "{0.real}".format(1) 4 | "{a.real}".format(a=1) | ^^^^^^^^^^^^^^^^^^^^^^ UP032 -5 | +5 | 6 | "{.real}".format(1.0) | = help: Convert to f-string @@ -63,7 +62,7 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | 4 | "{a.real}".format(a=1) -5 | +5 | 6 | "{.real}".format(1.0) | ^^^^^^^^^^^^^^^^^^^^^ UP032 7 | "{0.real}".format(1.0) @@ -106,7 +105,7 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call 7 | "{0.real}".format(1.0) 8 | "{a.real}".format(a=1.0) | ^^^^^^^^^^^^^^^^^^^^^^^^ UP032 - 9 | + 9 | 10 | "{.real}".format(1j) | = help: Convert to f-string @@ -124,7 +123,7 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | 8 | "{a.real}".format(a=1.0) - 9 | + 9 | 10 | "{.real}".format(1j) | ^^^^^^^^^^^^^^^^^^^^ UP032 11 | "{0.real}".format(1j) @@ -167,7 +166,7 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call 11 | "{0.real}".format(1j) 12 | "{a.real}".format(a=1j) | ^^^^^^^^^^^^^^^^^^^^^^^ UP032 -13 | +13 | 14 | "{.real}".format(0b01) | = help: Convert to f-string @@ -185,7 +184,7 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | 12 | "{a.real}".format(a=1j) -13 | +13 | 14 | "{.real}".format(0b01) | ^^^^^^^^^^^^^^^^^^^^^^ UP032 15 | "{0.real}".format(0b01) @@ -228,7 +227,7 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call 15 | "{0.real}".format(0b01) 16 | "{a.real}".format(a=0b01) | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 -17 | +17 | 18 | "{}".format(1 + 2) | = help: Convert to f-string @@ -246,7 +245,7 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | 16 | "{a.real}".format(a=0b01) -17 | +17 | 18 | "{}".format(1 + 2) | ^^^^^^^^^^^^^^^^^^ UP032 19 | "{}".format([1, 2]) @@ -331,7 +330,7 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call 21 | "{}".format({1: 2, 3: 4}) 22 | "{}".format((i for i in range(2))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP032 -23 | +23 | 24 | "{.real}".format(1 + 2) | = help: Convert to f-string @@ -349,7 +348,7 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | 22 | "{}".format((i for i in range(2))) -23 | +23 | 24 | "{.real}".format(1 + 2) | ^^^^^^^^^^^^^^^^^^^^^^^ UP032 25 | "{.real}".format([1, 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 98b05d49ac..4c93c84778 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP034.py:2:7: UP034 [*] Avoid extraneous parentheses | 1 | # UP034 2 | print(("foo")) | ^^^^^^^ UP034 -3 | +3 | 4 | # UP034 | = help: Remove extraneous parentheses @@ -25,7 +24,7 @@ UP034.py:5:7: UP034 [*] Avoid extraneous parentheses 4 | # UP034 5 | print(("hell((goodybe))o")) | ^^^^^^^^^^^^^^^^^^^^ UP034 -6 | +6 | 7 | # UP034 | = help: Remove extraneous parentheses @@ -45,7 +44,7 @@ UP034.py:8:7: UP034 [*] Avoid extraneous parentheses 7 | # UP034 8 | print((("foo"))) | ^^^^^^^^^ UP034 - 9 | + 9 | 10 | # UP034 | = help: Remove extraneous parentheses @@ -65,7 +64,7 @@ UP034.py:11:7: UP034 [*] Avoid extraneous parentheses 10 | # UP034 11 | print((((1)))) | ^^^^^^^ UP034 -12 | +12 | 13 | # UP034 | = help: Remove extraneous parentheses @@ -85,7 +84,7 @@ UP034.py:14:7: UP034 [*] Avoid extraneous parentheses 13 | # UP034 14 | print(("foo{}".format(1))) | ^^^^^^^^^^^^^^^^^^^ UP034 -15 | +15 | 16 | # UP034 | = help: Remove extraneous parentheses @@ -124,8 +123,7 @@ UP034.py:23:5: UP034 [*] Avoid extraneous parentheses | 21 | # UP034 22 | print( -23 | ( - | _____^ +23 | / ( 24 | | "foo" 25 | | ) | |_____^ UP034 @@ -152,7 +150,7 @@ UP034.py:30:13: UP034 [*] Avoid extraneous parentheses 29 | def f(): 30 | x = int(((yield 1))) | ^^^^^^^^^^^ UP034 -31 | +31 | 32 | # UP034 | = help: Remove extraneous parentheses @@ -192,7 +190,7 @@ UP034.py:39:7: UP034 [*] Avoid extraneous parentheses 38 | # UP034 39 | print((x for x in range(3))) | ^^^^^^^^^^^^^^^^^^^^^ UP034 -40 | +40 | 41 | # OK | = help: Remove extraneous parentheses 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 9c23af8835..497f7bec51 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys -2 | +2 | 3 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 4 | print("py2") @@ -28,7 +27,7 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | 6 | print("py3") - 7 | + 7 | 8 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 9 | if True: @@ -55,7 +54,7 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | 14 | print("py3") -15 | +15 | 16 | if sys.version_info < (3,0): print("PY2!") | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 17 | else: print("PY3!") @@ -99,7 +98,7 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | 23 | print("PY3") -24 | +24 | 25 | if sys.version_info < (3,0): print(1 if True else 3) | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 26 | else: @@ -122,7 +121,7 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | 27 | print("py3") -28 | +28 | 29 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 30 | def f(): @@ -151,7 +150,7 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | 35 | print("This the next") -36 | +36 | 37 | if sys.version_info > (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 38 | print("py3") @@ -175,7 +174,7 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | 43 | x = 1 -44 | +44 | 45 | if sys.version_info > (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 46 | print("py3") @@ -199,7 +198,7 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | 51 | x = 1 -52 | +52 | 53 | if sys.version_info > (3,0): print("py3") | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 54 | else: print("py2") @@ -220,7 +219,7 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | 54 | else: print("py2") -55 | +55 | 56 | if sys.version_info > (3,): | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 57 | print("py3") @@ -267,7 +266,7 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | 65 | print("py2") -66 | +66 | 67 | if sys.version_info < (3,): | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 68 | print("py2") @@ -317,7 +316,7 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | 84 | pass -85 | +85 | 86 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 87 | def f(py2): @@ -367,7 +366,7 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | 102 | # comment -103 | +103 | 104 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 105 | def f(): @@ -423,7 +422,7 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version 121 | if True: 122 | if sys.version_info > (3,): print(3) | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 -123 | +123 | 124 | if True: | = help: Remove outdated version block @@ -550,7 +549,7 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | 161 | "this for some reason") -162 | +162 | 163 | if sys.version_info > (3, 0): expected_error = \ | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 164 | [] @@ -570,10 +569,10 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | 164 | [] -165 | +165 | 166 | if sys.version_info > (3, 0): expected_error = [] | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 -167 | +167 | 168 | if sys.version_info > (3, 0): \ | = help: Remove outdated version block @@ -591,7 +590,7 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | 166 | if sys.version_info > (3, 0): expected_error = [] -167 | +167 | 168 | if sys.version_info > (3, 0): \ | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 169 | expected_error = [] @@ -633,7 +632,7 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version 175 | if True: 176 | if sys.version_info > (3, 0): expected_error = [] | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 -177 | +177 | 178 | if True: | = help: Remove outdated version block @@ -669,7 +668,7 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | 180 | expected_error = [] -181 | +181 | 182 | if sys.version_info < (3,13): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 183 | print("py3") @@ -689,7 +688,7 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:191:24: UP036 Version specifier is invalid | 189 | print("py3") -190 | +190 | 191 | if sys.version_info == 10000000: | ^^^^^^^^ UP036 192 | print("py3") @@ -698,7 +697,7 @@ UP036_0.py:191:24: UP036 Version specifier is invalid UP036_0.py:194:23: UP036 Version specifier is invalid | 192 | print("py3") -193 | +193 | 194 | if sys.version_info < (3,10000000): | ^^^^^^^^^^^^ UP036 195 | print("py3") @@ -707,7 +706,7 @@ UP036_0.py:194:23: UP036 Version specifier is invalid UP036_0.py:197:24: UP036 Version specifier is invalid | 195 | print("py3") -196 | +196 | 197 | if sys.version_info <= (3,10000000): | ^^^^^^^^^^^^ UP036 198 | print("py3") @@ -716,7 +715,7 @@ UP036_0.py:197:24: UP036 Version specifier is invalid UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version | 201 | print("py3") -202 | +202 | 203 | if sys.version_info >= (3,13): | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 204 | print("py3") @@ -757,7 +756,7 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | 208 | print("py3") -209 | +209 | 210 | if sys.version_info[:3] >= (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 211 | print("py3") @@ -778,7 +777,7 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version | 217 | print("py3") -218 | +218 | 219 | if sys.version_info > (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 220 | f"this is\ @@ -808,7 +807,7 @@ UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:229:4: UP036 [*] Version block is outdated for minimum Python version | 227 | allowed too" -228 | +228 | 229 | if sys.version_info[0] == 3: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 230 | print("py3") @@ -829,7 +828,7 @@ UP036_0.py:229:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:232:4: UP036 [*] Version block is outdated for minimum Python version | 230 | print("py3") -231 | +231 | 232 | if sys.version_info[0] <= 3: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 233 | print("py3") @@ -850,7 +849,7 @@ UP036_0.py:232:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:235:4: UP036 [*] Version block is outdated for minimum Python version | 233 | print("py3") -234 | +234 | 235 | if sys.version_info[0] < 3: | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 236 | print("py3") @@ -870,7 +869,7 @@ UP036_0.py:235:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:238:4: UP036 [*] Version block is outdated for minimum Python version | 236 | print("py3") -237 | +237 | 238 | if sys.version_info[0] >= 3: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 239 | print("py3") @@ -891,7 +890,7 @@ UP036_0.py:238:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:241:4: UP036 [*] Version block is outdated for minimum Python version | 239 | print("py3") -240 | +240 | 241 | if sys.version_info[0] > 3: | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 242 | print("py3") @@ -911,7 +910,7 @@ UP036_0.py:241:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:244:4: UP036 [*] Version block is outdated for minimum Python version | 242 | print("py3") -243 | +243 | 244 | if sys.version_info[0] == 2: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 245 | print("py3") @@ -931,7 +930,7 @@ UP036_0.py:244:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:247:4: UP036 [*] Version block is outdated for minimum Python version | 245 | print("py3") -246 | +246 | 247 | if sys.version_info[0] <= 2: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 248 | print("py3") @@ -951,7 +950,7 @@ UP036_0.py:247:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:250:4: UP036 [*] Version block is outdated for minimum Python version | 248 | print("py3") -249 | +249 | 250 | if sys.version_info[0] < 2: | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 251 | print("py3") @@ -971,7 +970,7 @@ UP036_0.py:250:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:253:4: UP036 [*] Version block is outdated for minimum Python version | 251 | print("py3") -252 | +252 | 253 | if sys.version_info[0] >= 2: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 254 | print("py3") @@ -992,7 +991,7 @@ UP036_0.py:253:4: UP036 [*] Version block is outdated for minimum Python version UP036_0.py:256:4: UP036 [*] Version block is outdated for minimum Python version | 254 | print("py3") -255 | +255 | 256 | if sys.version_info[0] > 2: | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 257 | print("py3") 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 9a7f623e26..a7619f0825 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys -2 | +2 | 3 | if sys.version_info == 2: | ^^^^^^^^^^^^^^^^^^^^^ UP036 4 | 2 @@ -28,7 +27,7 @@ UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | 6 | 3 - 7 | + 7 | 8 | if sys.version_info < (3,): | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 9 | 2 @@ -52,7 +51,7 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | 11 | 3 -12 | +12 | 13 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 14 | 2 @@ -76,7 +75,7 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | 16 | 3 -17 | +17 | 18 | if sys.version_info == 3: | ^^^^^^^^^^^^^^^^^^^^^ UP036 19 | 3 @@ -100,7 +99,7 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | 21 | 2 -22 | +22 | 23 | if sys.version_info > (3,): | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 24 | 3 @@ -124,7 +123,7 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | 26 | 2 -27 | +27 | 28 | if sys.version_info >= (3,): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 29 | 3 @@ -148,7 +147,7 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | 33 | from sys import version_info -34 | +34 | 35 | if version_info > (3,): | ^^^^^^^^^^^^^^^^^^^ UP036 36 | 3 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 964c71c65d..b5d6a7e33a 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version | 2 | from sys import version_info -3 | +3 | 4 | if sys.version_info > (3, 5): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 5 | 3+6 @@ -29,7 +28,7 @@ UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | 7 | 3-5 - 8 | + 8 | 9 | if version_info > (3, 5): | ^^^^^^^^^^^^^^^^^^^^^ UP036 10 | 3+6 @@ -53,7 +52,7 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | 12 | 3-5 -13 | +13 | 14 | if sys.version_info >= (3,6): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 15 | 3+6 @@ -77,7 +76,7 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | 17 | 3-5 -18 | +18 | 19 | if version_info >= (3,6): | ^^^^^^^^^^^^^^^^^^^^^ UP036 20 | 3+6 @@ -101,7 +100,7 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | 22 | 3-5 -23 | +23 | 24 | if sys.version_info < (3,6): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 25 | 3-5 @@ -125,7 +124,7 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | 27 | 3+6 -28 | +28 | 29 | if sys.version_info <= (3,5): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 30 | 3-5 @@ -149,7 +148,7 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | 32 | 3+6 -33 | +33 | 34 | if sys.version_info <= (3, 5): | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 35 | 3-5 @@ -173,7 +172,7 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | 37 | 3+6 -38 | +38 | 39 | if sys.version_info >= (3, 5): | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 40 | pass @@ -194,7 +193,7 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | 40 | pass -41 | +41 | 42 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 43 | pass @@ -234,7 +233,7 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | 47 | pass -48 | +48 | 49 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 50 | pass @@ -257,7 +256,7 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | 52 | pass -53 | +53 | 54 | if sys.version_info > (3,): | ^^^^^^^^^^^^^^^^^^^^^^^ UP036 55 | pass 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 aea4432b41..8b68445648 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys -2 | +2 | 3 | if sys.version_info < (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 4 | print("py2") 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 0d226c5168..fb13811cfe 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version | @@ -88,7 +87,7 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | 25 | cmd = [sys.executable, "-m", "test.regrtest"] -26 | +26 | 27 | if sys.version_info < (3, 3): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 28 | cmd = [sys.executable, "-m", "test.regrtest"] @@ -129,7 +128,7 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | 35 | cmd = [sys.executable, "-m", "test", "-j0"] -36 | +36 | 37 | if sys.version_info < (3, 3): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 38 | cmd = [sys.executable, "-m", "test.regrtest"] @@ -153,7 +152,7 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | 40 | cmd = [sys.executable, "-m", "test", "-j0"] -41 | +41 | 42 | if sys.version_info < (3, 3): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 43 | cmd = [sys.executable, "-m", "test.regrtest"] 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 62e5d77f2e..478ed274d9 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 @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys -2 | +2 | 3 | if sys.version_info < (3, 8): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 -4 | +4 | 5 | def a(): | = help: Remove outdated version block @@ -35,7 +34,7 @@ UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | 16 | import sys -17 | +17 | 18 | if sys.version_info < (3, 8): | ^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 19 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap index c323896def..f2eeea618b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP037_0.py:18:14: UP037 [*] Remove quotes from type annotation | @@ -114,7 +113,7 @@ UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation | 30 | x: Tuple["MyClass"] | ^^^^^^^^^ UP037 -31 | +31 | 32 | x: Callable[["MyClass"], None] | = help: Remove quotes @@ -132,7 +131,7 @@ UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation | 30 | x: Tuple["MyClass"] -31 | +31 | 32 | x: Callable[["MyClass"], None] | ^^^^^^^^^ UP037 | @@ -206,7 +205,7 @@ UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation | 47 | x: Annotated["str", "metadata"] | ^^^^^ UP037 -48 | +48 | 49 | x: Arg("str", "name") | = help: Remove quotes @@ -224,10 +223,10 @@ UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation | 47 | x: Annotated["str", "metadata"] -48 | +48 | 49 | x: Arg("str", "name") | ^^^^^ UP037 -50 | +50 | 51 | x: DefaultArg("str", "name") | = help: Remove quotes @@ -245,10 +244,10 @@ UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation | 49 | x: Arg("str", "name") -50 | +50 | 51 | x: DefaultArg("str", "name") | ^^^^^ UP037 -52 | +52 | 53 | x: NamedArg("str", "name") | = help: Remove quotes @@ -266,10 +265,10 @@ UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation | 51 | x: DefaultArg("str", "name") -52 | +52 | 53 | x: NamedArg("str", "name") | ^^^^^ UP037 -54 | +54 | 55 | x: DefaultNamedArg("str", "name") | = help: Remove quotes @@ -287,10 +286,10 @@ UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation | 53 | x: NamedArg("str", "name") -54 | +54 | 55 | x: DefaultNamedArg("str", "name") | ^^^^^ UP037 -56 | +56 | 57 | x: DefaultNamedArg("str", name="name") | = help: Remove quotes @@ -308,10 +307,10 @@ UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation | 55 | x: DefaultNamedArg("str", "name") -56 | +56 | 57 | x: DefaultNamedArg("str", name="name") | ^^^^^ UP037 -58 | +58 | 59 | x: VarArg("str") | = help: Remove quotes @@ -329,10 +328,10 @@ UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation | 57 | x: DefaultNamedArg("str", name="name") -58 | +58 | 59 | x: VarArg("str") | ^^^^^ UP037 -60 | +60 | 61 | x: List[List[List["MyClass"]]] | = help: Remove quotes @@ -350,10 +349,10 @@ UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation | 59 | x: VarArg("str") -60 | +60 | 61 | x: List[List[List["MyClass"]]] | ^^^^^^^^^ UP037 -62 | +62 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) | = help: Remove quotes @@ -371,10 +370,10 @@ UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation | 61 | x: List[List[List["MyClass"]]] -62 | +62 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) | ^^^^^ UP037 -64 | +64 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) | = help: Remove quotes @@ -392,10 +391,10 @@ UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation | 61 | x: List[List[List["MyClass"]]] -62 | +62 | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) | ^^^^^ UP037 -64 | +64 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) | = help: Remove quotes @@ -413,10 +412,10 @@ UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) -64 | +64 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) | ^^^^^ UP037 -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | = help: Remove quotes @@ -434,10 +433,10 @@ UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) -64 | +64 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) | ^^^^^ UP037 -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | = help: Remove quotes @@ -455,10 +454,10 @@ UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) -64 | +64 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) | ^^^^^ UP037 -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | = help: Remove quotes @@ -476,10 +475,10 @@ UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) -64 | +64 | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) | ^^^^^ UP037 -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | = help: Remove quotes @@ -497,10 +496,10 @@ UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | ^^^ UP037 -68 | +68 | 69 | X: MyCallable("X") | = help: Remove quotes @@ -518,10 +517,10 @@ UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | ^^^^^ UP037 -68 | +68 | 69 | X: MyCallable("X") | = help: Remove quotes @@ -539,10 +538,10 @@ UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) -66 | +66 | 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) | ^^^^^ UP037 -68 | +68 | 69 | X: MyCallable("X") | = help: Remove quotes diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_2.pyi.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_2.pyi.snap index 1519dba9d7..bffd9bbf7d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_2.pyi.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_2.pyi.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP037_2.pyi:3:14: UP037 [*] Remove quotes from type annotation | 1 | # https://github.com/astral-sh/ruff/issues/7102 -2 | +2 | 3 | def f(a: Foo['SingleLine # Comment']): ... | ^^^^^^^^^^^^^^^^^^^^^^^ UP037 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index d29c4723fe..83bd5dbd1f 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` | @@ -22,7 +21,7 @@ UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` 1 | isinstance(1, (int, float)) # UP038 2 | issubclass("yes", (int, float, str)) # UP038 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP038 -3 | +3 | 4 | isinstance(1, int) # OK | = help: Convert to `X | Y` 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 bb6346a05c..0e68a81b06 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP040.py:5:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -27,7 +26,7 @@ UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th 5 | x: typing.TypeAlias = int 6 | x: TypeAlias = int | ^^^^^^^^^^^^^^^^^^ UP040 -7 | +7 | 8 | # UP040 simple generic | = help: Use the `type` keyword @@ -48,7 +47,7 @@ UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 9 | T = typing.TypeVar["T"] 10 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -11 | +11 | 12 | # UP040 call style generic | = help: Use the `type` keyword @@ -69,7 +68,7 @@ UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 13 | T = typing.TypeVar("T") 14 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -15 | +15 | 16 | # UP040 bounded generic | = help: Use the `type` keyword @@ -90,7 +89,7 @@ UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 17 | T = typing.TypeVar("T", bound=int) 18 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -19 | +19 | 20 | # UP040 constrained generic | = help: Use the `type` keyword @@ -111,7 +110,7 @@ UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 21 | T = typing.TypeVar("T", int, str) 22 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -23 | +23 | 24 | # UP040 contravariant generic | = help: Use the `type` keyword @@ -132,7 +131,7 @@ UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 25 | T = typing.TypeVar("T", contravariant=True) 26 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -27 | +27 | 28 | # UP040 covariant generic | = help: Use the `type` keyword @@ -153,7 +152,7 @@ UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 29 | T = typing.TypeVar("T", covariant=True) 30 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -31 | +31 | 32 | # UP040 in class scope | = help: Use the `type` keyword @@ -174,7 +173,7 @@ UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 35 | # reference to global variable 36 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -37 | +37 | 38 | # reference to class variable | = help: Use the `type` keyword @@ -195,7 +194,7 @@ UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of t 39 | TCLS = typing.TypeVar["TCLS"] 40 | y: typing.TypeAlias = list[TCLS] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -41 | +41 | 42 | # UP040 won't add generics in fix | = help: Use the `type` keyword @@ -216,7 +215,7 @@ UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 43 | T = typing.TypeVar(*args) 44 | x: typing.TypeAlias = list[T] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -45 | +45 | 46 | # OK | = help: Use the `type` keyword @@ -258,7 +257,7 @@ UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme 64 | | "PositiveList", list[Annotated[T, Gt(0)]], type_params=(T,) 65 | | ) | |_^ UP040 -66 | +66 | 67 | # Bound | = help: Use the `type` keyword @@ -283,7 +282,7 @@ UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme 70 | | "PositiveList", list[Annotated[T, Gt(0)]], type_params=(T,) 71 | | ) | |_^ UP040 -72 | +72 | 73 | # Multiple bounds | = help: Use the `type` keyword @@ -306,7 +305,7 @@ UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment ins 76 | T3 = TypeVar("T3") 77 | Tuple3 = TypeAliasType("Tuple3", tuple[T1, T2, T3], type_params=(T1, T2, T3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -78 | +78 | 79 | # No type_params | = help: Use the `type` keyword @@ -346,7 +345,7 @@ UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) 81 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)], type_params=()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 -82 | +82 | 83 | # OK: Other name | = help: Use the `type` keyword 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 0794f714e4..b236c324f1 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias | 8 | from datetime import timezone - 9 | + 9 | 10 | print(timezone.utc) | ^^^^^^^^^^^^ UP017 | @@ -29,7 +28,7 @@ UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias | 14 | from datetime import timezone as tz -15 | +15 | 16 | print(tz.utc) | ^^^^^^ UP017 | @@ -53,7 +52,7 @@ UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias | 20 | import datetime -21 | +21 | 22 | print(datetime.timezone.utc) | ^^^^^^^^^^^^^^^^^^^^^ UP017 | @@ -72,7 +71,7 @@ UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias | 26 | import datetime as dt -27 | +27 | 28 | print(dt.timezone.utc) | ^^^^^^^^^^^^^^^ UP017 | 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 a1794b6f27..eb69749335 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type annotation | @@ -44,7 +43,7 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | ^^^^ UP006 | @@ -60,7 +59,7 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | ^^^^ UP006 | 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 a1794b6f27..eb69749335 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type annotation | @@ -44,7 +43,7 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | ^^^^ UP006 | @@ -60,7 +59,7 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | ^^^^ UP006 | 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 ebd2b1f889..525b392e7c 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ UP007 -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | = help: Convert to `X | Y` 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 a010c8ef19..f88a3b32fb 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs -snapshot_kind: text --- future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ UP007 -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | = help: Convert to `X | Y` @@ -23,7 +22,7 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None -41 | +41 | 42 | MyList: TypeAlias = Union[List[int], List[str]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 | 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 986f9ddb26..f4db6c7a56 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` | 1 | # Errors. -2 | +2 | 3 | print("") | ^^^^^^^^^ FURB105 4 | print("", sep=",") @@ -362,7 +361,7 @@ FURB105.py:21:1: FURB105 [*] Unnecessary separator passed to `print` 20 | print(sep="\t") 21 | print(sep=print(1)) | ^^^^^^^^^^^^^^^^^^^ FURB105 -22 | +22 | 23 | # OK. | = help: Remove separator diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap index 005971005c..a19b474227 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB116.py:6:7: FURB116 [*] Replace `oct` call with `f"{num:o}"` | 4 | return num -5 | +5 | 6 | print(oct(num)[2:]) # FURB116 | ^^^^^^^^^^^^ FURB116 7 | print(hex(num)[2:]) # FURB116 @@ -48,7 +47,7 @@ FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` 7 | print(hex(num)[2:]) # FURB116 8 | print(bin(num)[2:]) # FURB116 | ^^^^^^^^^^^^ FURB116 - 9 | + 9 | 10 | print(oct(1337)[2:]) # FURB116 | = help: Replace with `f"{num:b}"` @@ -66,7 +65,7 @@ FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` | 8 | print(bin(num)[2:]) # FURB116 - 9 | + 9 | 10 | print(oct(1337)[2:]) # FURB116 | ^^^^^^^^^^^^^ FURB116 11 | print(hex(1337)[2:]) # FURB116 @@ -109,7 +108,7 @@ FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` 11 | print(hex(1337)[2:]) # FURB116 12 | print(bin(1337)[2:]) # FURB116 | ^^^^^^^^^^^^^ FURB116 -13 | +13 | 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) | = help: Replace with `f"{1337:b}"` @@ -127,7 +126,7 @@ FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` FURB116.py:14:7: FURB116 Replace `bin` call with f-string | 12 | print(bin(1337)[2:]) # FURB116 -13 | +13 | 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) | ^^^^^^^^^^^^^^^^^^^^^ FURB116 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) @@ -139,7 +138,7 @@ FURB116.py:15:7: FURB116 Replace `bin` call with f-string 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) | ^^^^^^^^^^^^^^^^^^^^^^ FURB116 -16 | +16 | 17 | ## invalid | = help: Replace with f-string diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap index 3d21ba0d73..f2efa2fbb2 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap @@ -68,7 +68,7 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda 4 | op_pos = lambda x: +x 5 | op_neg = lambda x: -x | ^^^^^^^^^^^^ FURB118 -6 | +6 | 7 | op_add = lambda x, y: x + y | = help: Replace with `operator.neg` @@ -88,7 +88,7 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda | 5 | op_neg = lambda x: -x -6 | +6 | 7 | op_add = lambda x, y: x + y | ^^^^^^^^^^^^^^^^^^ FURB118 8 | op_sub = lambda x, y: x - y @@ -410,7 +410,7 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb 18 | op_bitand = lambda x, y: x & y 19 | op_floordiv = lambda x, y: x // y | ^^^^^^^^^^^^^^^^^^^ FURB118 -20 | +20 | 21 | op_eq = lambda x, y: x == y | = help: Replace with `operator.floordiv` @@ -434,7 +434,7 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda | 19 | op_floordiv = lambda x, y: x // y -20 | +20 | 21 | op_eq = lambda x, y: x == y | ^^^^^^^^^^^^^^^^^^^ FURB118 22 | op_ne = lambda x, y: x != y @@ -879,7 +879,7 @@ FURB118.py:89:17: FURB118 [*] Use `operator.itemgetter((1, slice(None)))` instea 88 | op_itemgetter = lambda x: x[:, 1] 89 | op_itemgetter = lambda x: x[1, :] | ^^^^^^^^^^^^^^^^^ FURB118 -90 | +90 | 91 | # With a slice, trivia is dropped | = help: Replace with `operator.itemgetter((1, slice(None)))` @@ -905,7 +905,7 @@ FURB118.py:92:17: FURB118 [*] Use `operator.itemgetter((1, slice(None)))` instea 91 | # With a slice, trivia is dropped 92 | op_itemgetter = lambda x: x[1, :] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB118 -93 | +93 | 94 | # Without a slice, trivia is retained | = help: Replace with `operator.itemgetter((1, slice(None)))` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap index faa3ec5314..c11b60c272 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB129.py:7:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -70,7 +69,7 @@ FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over fil 10 | b = {line.upper() for line in f.readlines()} 11 | c = {line.lower(): line.upper() for line in f.readlines()} | ^^^^^^^^^^^^^ FURB129 -12 | +12 | 13 | with Path("FURB129.py").open() as f: | = help: Remove `readlines()` @@ -107,7 +106,7 @@ FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 15 | pass -16 | +16 | 17 | for _line in open("FURB129.py").readlines(): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB129 18 | pass @@ -127,7 +126,7 @@ FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 18 | pass -19 | +19 | 20 | for _line in Path("FURB129.py").open().readlines(): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB129 21 | pass 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 4e9058da5f..8928bc8483 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -136,7 +135,7 @@ FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice 47 | # FURB131 48 | del x[:] | ^^^^^^^^ FURB131 -49 | +49 | 50 | x = 1 | = help: Replace with `clear()` @@ -157,7 +156,7 @@ FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice 57 | # FURB131 58 | del sneaky[:] | ^^^^^^^^^^^^^ FURB131 -59 | +59 | 60 | # these should not | = help: Replace with `clear()` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap index 0299299bc0..91386ad528 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)` | 2 | y = 2 -3 | +3 | 4 | x if x > y else y # FURB136 | ^^^^^^^^^^^^^^^^^ FURB136 -5 | +5 | 6 | x if x >= y else y # FURB136 | = help: Replace with `max(y, x)` @@ -26,10 +25,10 @@ FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)` FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` | 4 | x if x > y else y # FURB136 -5 | +5 | 6 | x if x >= y else y # FURB136 | ^^^^^^^^^^^^^^^^^^ FURB136 -7 | +7 | 8 | x if x < y else y # FURB136 | = help: Replace with `max(x, y)` @@ -47,10 +46,10 @@ FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` | 6 | x if x >= y else y # FURB136 - 7 | + 7 | 8 | x if x < y else y # FURB136 | ^^^^^^^^^^^^^^^^^ FURB136 - 9 | + 9 | 10 | x if x <= y else y # FURB136 | = help: Replace with `min(y, x)` @@ -68,10 +67,10 @@ FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` | 8 | x if x < y else y # FURB136 - 9 | + 9 | 10 | x if x <= y else y # FURB136 | ^^^^^^^^^^^^^^^^^^ FURB136 -11 | +11 | 12 | y if x > y else x # FURB136 | = help: Replace with `min(x, y)` @@ -89,10 +88,10 @@ FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` | 10 | x if x <= y else y # FURB136 -11 | +11 | 12 | y if x > y else x # FURB136 | ^^^^^^^^^^^^^^^^^ FURB136 -13 | +13 | 14 | y if x >= y else x # FURB136 | = help: Replace with `min(x, y)` @@ -110,10 +109,10 @@ FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` | 12 | y if x > y else x # FURB136 -13 | +13 | 14 | y if x >= y else x # FURB136 | ^^^^^^^^^^^^^^^^^^ FURB136 -15 | +15 | 16 | y if x < y else x # FURB136 | = help: Replace with `min(y, x)` @@ -131,10 +130,10 @@ FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` | 14 | y if x >= y else x # FURB136 -15 | +15 | 16 | y if x < y else x # FURB136 | ^^^^^^^^^^^^^^^^^ FURB136 -17 | +17 | 18 | y if x <= y else x # FURB136 | = help: Replace with `max(x, y)` @@ -152,10 +151,10 @@ FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` | 16 | y if x < y else x # FURB136 -17 | +17 | 18 | y if x <= y else x # FURB136 | ^^^^^^^^^^^^^^^^^^ FURB136 -19 | +19 | 20 | x + y if x > y else y # OK | = help: Replace with `max(y, x)` @@ -173,7 +172,7 @@ FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` | 20 | x + y if x > y else y # OK -21 | +21 | 22 | / x if ( 23 | | x 24 | | > y 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 c9a123466a..7748edac5a 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 @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 6 | # FURB140 7 | [print(x, y) for x, y in zipped()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB140 -8 | +8 | 9 | # FURB140 | = help: Replace with `itertools.starmap` @@ -31,7 +30,7 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator 9 | # FURB140 10 | (print(x, y) for x, y in zipped()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB140 -11 | +11 | 12 | # FURB140 | = help: Replace with `itertools.starmap` @@ -79,7 +78,7 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator 18 | # FURB140 19 | [print(x, y) for x, y in zipped()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB140 -20 | +20 | 21 | # FURB140 | = help: Replace with `itertools.starmap` @@ -99,7 +98,7 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator 21 | # FURB140 22 | (print(x, y) for x, y in zipped()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB140 -23 | +23 | 24 | # FURB140 | = help: Replace with `itertools.starmap` @@ -119,7 +118,7 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator 24 | # FURB140 25 | {print(x, y) for x, y in zipped()} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB140 -26 | +26 | 27 | # FURB140 (check it still flags starred arguments). | = help: Replace with `itertools.starmap` @@ -181,7 +180,7 @@ FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator 30 | (foo(*t) for t in [(85, 60), (100, 80)]) 31 | {foo(*t) for t in [(85, 60), (100, 80)]} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB140 -32 | +32 | 33 | # Non-errors. | = help: Replace with `itertools.starmap` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap index 81965e9793..18021e3544 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap @@ -1,15 +1,14 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB142.py:5:1: FURB142 [*] Use of `set.add()` in a for loop | 3 | s = set() -4 | +4 | 5 | / for x in [1, 2, 3]: 6 | | s.add(x) | |____________^ FURB142 -7 | +7 | 8 | for x in {1, 2, 3}: | = help: Replace with `.update()` @@ -28,11 +27,11 @@ FURB142.py:5:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop | 6 | s.add(x) - 7 | + 7 | 8 | / for x in {1, 2, 3}: 9 | | s.add(x) | |____________^ FURB142 -10 | +10 | 11 | for x in (1, 2, 3): | = help: Replace with `.update()` @@ -51,11 +50,11 @@ FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop | 9 | s.add(x) -10 | +10 | 11 | / for x in (1, 2, 3): 12 | | s.add(x) | |____________^ FURB142 -13 | +13 | 14 | for x in (1, 2, 3): | = help: Replace with `.update()` @@ -74,11 +73,11 @@ FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop | 12 | s.add(x) -13 | +13 | 14 | / for x in (1, 2, 3): 15 | | s.discard(x) | |________________^ FURB142 -16 | +16 | 17 | for x in (1, 2, 3): | = help: Replace with `.difference_update()` @@ -97,11 +96,11 @@ FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop | 15 | s.discard(x) -16 | +16 | 17 | / for x in (1, 2, 3): 18 | | s.add(x + 1) | |________________^ FURB142 -19 | +19 | 20 | for x, y in ((1, 2), (3, 4)): | = help: Replace with `.update()` @@ -120,11 +119,11 @@ FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop | 18 | s.add(x + 1) -19 | +19 | 20 | / for x, y in ((1, 2), (3, 4)): 21 | | s.add((x, y)) | |_________________^ FURB142 -22 | +22 | 23 | num = 123 | = help: Replace with `.update()` @@ -143,11 +142,11 @@ FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop | 23 | num = 123 -24 | +24 | 25 | / for x in (1, 2, 3): 26 | | s.add(num) | |______________^ FURB142 -27 | +27 | 28 | for x in (1, 2, 3): | = help: Replace with `.update()` @@ -166,11 +165,11 @@ FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop | 26 | s.add(num) -27 | +27 | 28 | / for x in (1, 2, 3): 29 | | s.add((num, x)) | |___________________^ FURB142 -30 | +30 | 31 | for x in (1, 2, 3): | = help: Replace with `.update()` @@ -189,11 +188,11 @@ FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop | 29 | s.add((num, x)) -30 | +30 | 31 | / for x in (1, 2, 3): 32 | | s.add(x + num) | |__________________^ FURB142 -33 | +33 | 34 | # False negative | = help: Replace with `.update()` 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 3cc3c1ece6..176f2c59e5 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing | @@ -111,7 +110,7 @@ FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing 8 | l[:] 9 | print(l[:]) | ^^^^ FURB145 -10 | +10 | 11 | # False negatives. | = help: Replace with `copy()` 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 76ccacebb2..a6b220ffee 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -24,7 +23,7 @@ FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 15 | print(index) -16 | +16 | 17 | for index, _ in enumerate(books, start=0): | ^^^^^^^^^ FURB148 18 | print(index) @@ -44,7 +43,7 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 18 | print(index) -19 | +19 | 20 | for index, _ in enumerate(books, 0): | ^^^^^^^^^ FURB148 21 | print(index) @@ -64,7 +63,7 @@ FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:23:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead | 21 | print(index) -22 | +22 | 23 | for index, _ in enumerate(books, start=1): | ^^^^^^^^^ FURB148 24 | print(index) @@ -74,7 +73,7 @@ FURB148.py:23:17: FURB148 `enumerate` value is unused, use `for x in range(len(y FURB148.py:26:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead | 24 | print(index) -25 | +25 | 26 | for index, _ in enumerate(books, 1): | ^^^^^^^^^ FURB148 27 | print(index) @@ -84,7 +83,7 @@ FURB148.py:26:17: FURB148 `enumerate` value is unused, use `for x in range(len(y FURB148.py:29:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead | 27 | print(index) -28 | +28 | 29 | for index, _ in enumerate(books, start=x): | ^^^^^^^^^ FURB148 30 | print(book) @@ -94,7 +93,7 @@ FURB148.py:29:17: FURB148 `enumerate` value is unused, use `for x in range(len(y FURB148.py:32:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead | 30 | print(book) -31 | +31 | 32 | for index, _ in enumerate(books, x): | ^^^^^^^^^ FURB148 33 | print(book) @@ -104,7 +103,7 @@ FURB148.py:32:17: FURB148 `enumerate` value is unused, use `for x in range(len(y FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 33 | print(book) -34 | +34 | 35 | for _, book in enumerate(books): | ^^^^^^^^^ FURB148 36 | print(book) @@ -124,7 +123,7 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 36 | print(book) -37 | +37 | 38 | for _, book in enumerate(books, start=0): | ^^^^^^^^^ FURB148 39 | print(book) @@ -144,7 +143,7 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 39 | print(book) -40 | +40 | 41 | for _, book in enumerate(books, 0): | ^^^^^^^^^ FURB148 42 | print(book) @@ -164,7 +163,7 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 42 | print(book) -43 | +43 | 44 | for _, book in enumerate(books, start=1): | ^^^^^^^^^ FURB148 45 | print(book) @@ -184,7 +183,7 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 45 | print(book) -46 | +46 | 47 | for _, book in enumerate(books, 1): | ^^^^^^^^^ FURB148 48 | print(book) @@ -204,7 +203,7 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 48 | print(book) -49 | +49 | 50 | for _, book in enumerate(books, start=x): | ^^^^^^^^^ FURB148 51 | print(book) @@ -224,7 +223,7 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 51 | print(book) -52 | +52 | 53 | for _, book in enumerate(books, x): | ^^^^^^^^^ FURB148 54 | print(book) @@ -244,7 +243,7 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 54 | print(book) -55 | +55 | 56 | for index, (_, _) in enumerate(books): | ^^^^^^^^^ FURB148 57 | print(index) @@ -264,7 +263,7 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 57 | print(index) -58 | +58 | 59 | for (_, _), book in enumerate(books): | ^^^^^^^^^ FURB148 60 | print(book) @@ -284,7 +283,7 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 60 | print(book) -61 | +61 | 62 | for(index, _)in enumerate(books): | ^^^^^^^^^ FURB148 63 | print(index) @@ -304,7 +303,7 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 63 | print(index) -64 | +64 | 65 | for(index), _ in enumerate(books): | ^^^^^^^^^ FURB148 66 | print(index) @@ -324,7 +323,7 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 66 | print(index) -67 | +67 | 68 | for index, _ in enumerate(books_and_authors): | ^^^^^^^^^ FURB148 69 | print(index) @@ -344,7 +343,7 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 69 | print(index) -70 | +70 | 71 | for _, book in enumerate(books_and_authors): | ^^^^^^^^^ FURB148 72 | print(book) @@ -364,7 +363,7 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 72 | print(book) -73 | +73 | 74 | for index, _ in enumerate(books_set): | ^^^^^^^^^ FURB148 75 | print(index) @@ -384,7 +383,7 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 75 | print(index) -76 | +76 | 77 | for _, book in enumerate(books_set): | ^^^^^^^^^ FURB148 78 | print(book) @@ -404,7 +403,7 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 78 | print(book) -79 | +79 | 80 | for index, _ in enumerate(books_tuple): | ^^^^^^^^^ FURB148 81 | print(index) @@ -424,7 +423,7 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 81 | print(index) -82 | +82 | 83 | for _, book in enumerate(books_tuple): | ^^^^^^^^^ FURB148 84 | print(book) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap index 4714a3437b..c51afdd85a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB152.py:3:5: FURB152 [*] Replace `3.14` with `math.pi` | 1 | r = 3.1 # OK -2 | +2 | 3 | A = 3.14 * r ** 2 # FURB152 | ^^^^ FURB152 -4 | +4 | 5 | C = 6.28 * r # FURB152 | = help: Use `math.pi` @@ -26,10 +25,10 @@ FURB152.py:3:5: FURB152 [*] Replace `3.14` with `math.pi` FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` | 3 | A = 3.14 * r ** 2 # FURB152 -4 | +4 | 5 | C = 6.28 * r # FURB152 | ^^^^ FURB152 -6 | +6 | 7 | e = 2.71 # FURB152 | = help: Use `math.tau` @@ -49,10 +48,10 @@ FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` | 5 | C = 6.28 * r # FURB152 -6 | +6 | 7 | e = 2.71 # FURB152 | ^^^^ FURB152 -8 | +8 | 9 | r = 3.15 # OK | = help: Use `math.e` @@ -74,10 +73,10 @@ FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` | 9 | r = 3.15 # OK -10 | +10 | 11 | r = 3.141 # FURB152 | ^^^^^ FURB152 -12 | +12 | 13 | r = 3.142 # FURB152 | = help: Use `math.pi` @@ -100,10 +99,10 @@ FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` | 11 | r = 3.141 # FURB152 -12 | +12 | 13 | r = 3.142 # FURB152 | ^^^^^ FURB152 -14 | +14 | 15 | r = 3.1415 # FURB152 | = help: Use `math.pi` @@ -126,10 +125,10 @@ FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` | 13 | r = 3.142 # FURB152 -14 | +14 | 15 | r = 3.1415 # FURB152 | ^^^^^^ FURB152 -16 | +16 | 17 | r = 3.1416 # FURB152 | = help: Use `math.pi` @@ -152,10 +151,10 @@ FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` | 15 | r = 3.1415 # FURB152 -16 | +16 | 17 | r = 3.1416 # FURB152 | ^^^^^^ FURB152 -18 | +18 | 19 | r = 3.141592 # FURB152 | = help: Use `math.pi` @@ -178,10 +177,10 @@ FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` | 17 | r = 3.1416 # FURB152 -18 | +18 | 19 | r = 3.141592 # FURB152 | ^^^^^^^^ FURB152 -20 | +20 | 21 | r = 3.141593 # FURB152 | = help: Use `math.pi` @@ -204,10 +203,10 @@ FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` | 19 | r = 3.141592 # FURB152 -20 | +20 | 21 | r = 3.141593 # FURB152 | ^^^^^^^^ FURB152 -22 | +22 | 23 | r = 3.14159265 # FURB152 | = help: Use `math.pi` @@ -230,10 +229,10 @@ FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` | 21 | r = 3.141593 # FURB152 -22 | +22 | 23 | r = 3.14159265 # FURB152 | ^^^^^^^^^^ FURB152 -24 | +24 | 25 | r = 3.141592653589793238462643383279 # FURB152 | = help: Use `math.pi` @@ -256,10 +255,10 @@ FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `math.pi` | 23 | r = 3.14159265 # FURB152 -24 | +24 | 25 | r = 3.141592653589793238462643383279 # FURB152 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB152 -26 | +26 | 27 | r = 3.14159266 # OK | = help: Use `math.pi` @@ -282,10 +281,10 @@ FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `ma FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` | 29 | e = 2.7 # OK -30 | +30 | 31 | e = 2.718 # FURB152 | ^^^^^ FURB152 -32 | +32 | 33 | e = 2.7182 # FURB152 | = help: Use `math.e` @@ -308,10 +307,10 @@ FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` | 31 | e = 2.718 # FURB152 -32 | +32 | 33 | e = 2.7182 # FURB152 | ^^^^^^ FURB152 -34 | +34 | 35 | e = 2.7183 # FURB152 | = help: Use `math.e` @@ -334,10 +333,10 @@ FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` | 33 | e = 2.7182 # FURB152 -34 | +34 | 35 | e = 2.7183 # FURB152 | ^^^^^^ FURB152 -36 | +36 | 37 | e = 2.719 # OK | = help: Use `math.e` @@ -360,7 +359,7 @@ FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` | 43 | e = 2.718200000000001 # OK -44 | +44 | 45 | e = 2.7182000000000001 # FURB152 | ^^^^^^^^^^^^^^^^^^ FURB152 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap index 967e552a1b..4ead349089 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap @@ -152,7 +152,7 @@ FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor 11 | Decimal(float("nan")) 12 | decimal.Decimal("0") | ^^^ FURB157 -13 | +13 | 14 | # OK | = help: Replace with `0` @@ -192,7 +192,7 @@ FURB157.py:24:9: FURB157 [*] Verbose expression in `Decimal` constructor 23 | Decimal("1_000") 24 | Decimal("__1____000") | ^^^^^^^^^^^^ FURB157 -25 | +25 | 26 | # Ok | = help: Replace with `1000` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap index d9385176d9..7888f39f7d 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB161.py:6:9: FURB161 [*] Use of `bin(x).count('1')` | 4 | return 10 -5 | +5 | 6 | count = bin(x).count("1") # FURB161 | ^^^^^^^^^^^^^^^^^ FURB161 7 | count = bin(10).count("1") # FURB161 @@ -174,7 +173,7 @@ FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` 13 | count = bin((10)).count("1") # FURB161 14 | count = bin("10" "15").count("1") # FURB161 | ^^^^^^^^^^^^^^^^^^^^^^^^^ FURB161 -15 | +15 | 16 | count = x.bit_count() # OK | = help: Replace with `("10" "15").bit_count()` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap index 32df4b1d7d..0985c7f1c9 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB163.py:4:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redundant base | @@ -153,7 +152,7 @@ FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redun 11 | math.log(1, 2.0) 12 | math.log(1, 10.0) | ^^^^^^^^^^^^^^^^^ FURB163 -13 | +13 | 14 | # OK | = help: Replace with `math.log10(1)` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap index d07e82b376..e15af106a4 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB164.py:7:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | @@ -342,7 +341,7 @@ FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 21 | _ = Decimal.from_float(float("-Infinity")) 22 | _ = Decimal.from_float(float("nan")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB164 -23 | +23 | 24 | # OK | = help: Replace with `Decimal` constructor diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap index 4f698d4136..162b036f6a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB166.py:3:5: FURB166 [*] Use of `int` with explicit `base=2` after removing prefix | 1 | # Errors -2 | +2 | 3 | _ = int("0b1010"[2:], 2) | ^^^^^^^^^^^^^^^^^^^^ FURB166 4 | _ = int("0o777"[2:], 8) @@ -47,7 +46,7 @@ FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing 4 | _ = int("0o777"[2:], 8) 5 | _ = int("0xFFFF"[2:], 16) | ^^^^^^^^^^^^^^^^^^^^^ FURB166 -6 | +6 | 7 | b = "0b11" | = help: Replace with `base=0` @@ -67,7 +66,7 @@ FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p 7 | b = "0b11" 8 | _ = int(b[2:], 2) | ^^^^^^^^^^^^^ FURB166 - 9 | + 9 | 10 | _ = int("0xFFFF"[2:], base=16) | = help: Replace with `base=0` @@ -85,10 +84,10 @@ FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | 8 | _ = int(b[2:], 2) - 9 | + 9 | 10 | _ = int("0xFFFF"[2:], base=16) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB166 -11 | +11 | 12 | _ = int(b"0xFFFF"[2:], 16) | = help: Replace with `base=0` @@ -106,7 +105,7 @@ FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | 10 | _ = int("0xFFFF"[2:], base=16) -11 | +11 | 12 | _ = int(b"0xFFFF"[2:], 16) | ^^^^^^^^^^^^^^^^^^^^^^ FURB166 | @@ -126,7 +125,7 @@ FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | 19 | _ = int(get_str()[2:], 16) | ^^^^^^^^^^^^^^^^^^^^^^ FURB166 -20 | +20 | 21 | # OK | = help: Replace with `base=0` 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 c27d38bc58..4afe7602fb 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB168.py:5:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 3 | # Errors. -4 | +4 | 5 | if isinstance(foo, type(None)): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 6 | pass @@ -25,7 +24,7 @@ FURB168.py:5:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 6 | pass -7 | +7 | 8 | if isinstance(foo, (type(None))): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 9 | pass @@ -45,7 +44,7 @@ FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 9 | pass -10 | +10 | 11 | if isinstance(foo, (type(None), type(None), type(None))): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 12 | pass @@ -65,7 +64,7 @@ FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 12 | pass -13 | +13 | 14 | if isinstance(foo, None | None): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 15 | pass @@ -85,7 +84,7 @@ FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 15 | pass -16 | +16 | 17 | if isinstance(foo, (None | None)): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 18 | pass @@ -105,7 +104,7 @@ FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 18 | pass -19 | +19 | 20 | if isinstance(foo, None | type(None)): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 21 | pass @@ -125,7 +124,7 @@ FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 21 | pass -22 | +22 | 23 | if isinstance(foo, (None | type(None))): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB168 24 | pass 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 6db38df6cb..2c98aa98d3 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 @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB169.py:5:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 3 | # Error. -4 | +4 | 5 | type(foo) is type(None) | ^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -6 | +6 | 7 | type(None) is type(foo) | = help: Replace with `foo is None` @@ -26,10 +25,10 @@ FURB169.py:5:1: FURB169 [*] Compare the identities of `foo` and `None` instead o FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 5 | type(foo) is type(None) -6 | +6 | 7 | type(None) is type(foo) | ^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -8 | +8 | 9 | type(None) is type(None) | = help: Replace with `foo is None` @@ -47,10 +46,10 @@ FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead o FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 7 | type(None) is type(foo) - 8 | + 8 | 9 | type(None) is type(None) | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -10 | +10 | 11 | type(foo) is not type(None) | = help: Replace with `None is None` @@ -68,10 +67,10 @@ FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 9 | type(None) is type(None) -10 | +10 | 11 | type(foo) is not type(None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -12 | +12 | 13 | type(None) is not type(foo) | = help: Replace with `foo is not None` @@ -89,10 +88,10 @@ FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 11 | type(foo) is not type(None) -12 | +12 | 13 | type(None) is not type(foo) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -14 | +14 | 15 | type(None) is not type(None) | = help: Replace with `foo is not None` @@ -110,10 +109,10 @@ FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 13 | type(None) is not type(foo) -14 | +14 | 15 | type(None) is not type(None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -16 | +16 | 17 | type(foo) == type(None) | = help: Replace with `None is not None` @@ -131,10 +130,10 @@ FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 15 | type(None) is not type(None) -16 | +16 | 17 | type(foo) == type(None) | ^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -18 | +18 | 19 | type(None) == type(foo) | = help: Replace with `foo is None` @@ -152,10 +151,10 @@ FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 17 | type(foo) == type(None) -18 | +18 | 19 | type(None) == type(foo) | ^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -20 | +20 | 21 | type(None) == type(None) | = help: Replace with `foo is None` @@ -173,10 +172,10 @@ FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 19 | type(None) == type(foo) -20 | +20 | 21 | type(None) == type(None) | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -22 | +22 | 23 | type(foo) != type(None) | = help: Replace with `None is None` @@ -194,10 +193,10 @@ FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 21 | type(None) == type(None) -22 | +22 | 23 | type(foo) != type(None) | ^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -24 | +24 | 25 | type(None) != type(foo) | = help: Replace with `foo is not None` @@ -215,10 +214,10 @@ FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 23 | type(foo) != type(None) -24 | +24 | 25 | type(None) != type(foo) | ^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -26 | +26 | 27 | type(None) != type(None) | = help: Replace with `foo is not None` @@ -236,10 +235,10 @@ FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 25 | type(None) != type(foo) -26 | +26 | 27 | type(None) != type(None) | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB169 -28 | +28 | 29 | # Ok. | = help: Replace with `None is not None` 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 7124e3e5c7..5aab5d8010 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 @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB171.py:3:4: FURB171 [*] Membership test against single-item container | 1 | # Errors. -2 | +2 | 3 | if 1 in (1,): | ^^^^^^^^^ FURB171 4 | print("Single-element tuple") @@ -24,7 +23,7 @@ FURB171.py:3:4: FURB171 [*] Membership test against single-item container FURB171.py:6:4: FURB171 [*] Membership test against single-item container | 4 | print("Single-element tuple") -5 | +5 | 6 | if 1 in [1]: | ^^^^^^^^ FURB171 7 | print("Single-element list") @@ -44,7 +43,7 @@ FURB171.py:6:4: FURB171 [*] Membership test against single-item container FURB171.py:9:4: FURB171 [*] Membership test against single-item container | 7 | print("Single-element list") - 8 | + 8 | 9 | if 1 in {1}: | ^^^^^^^^ FURB171 10 | print("Single-element set") @@ -64,7 +63,7 @@ FURB171.py:9:4: FURB171 [*] Membership test against single-item container FURB171.py:12:4: FURB171 [*] Membership test against single-item container | 10 | print("Single-element set") -11 | +11 | 12 | if "a" in "a": | ^^^^^^^^^^ FURB171 13 | print("Single-element string") @@ -84,7 +83,7 @@ FURB171.py:12:4: FURB171 [*] Membership test against single-item container FURB171.py:15:4: FURB171 [*] Membership test against single-item container | 13 | print("Single-element string") -14 | +14 | 15 | if 1 not in (1,): | ^^^^^^^^^^^^^ FURB171 16 | print("Check `not in` membership test") @@ -104,7 +103,7 @@ FURB171.py:15:4: FURB171 [*] Membership test against single-item container FURB171.py:18:8: FURB171 [*] Membership test against single-item container | 16 | print("Check `not in` membership test") -17 | +17 | 18 | if not 1 in (1,): | ^^^^^^^^^ FURB171 19 | print("Check the negated membership test") diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap index e87eb04f57..567479ed72 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB177_FURB177.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB177.py:5:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups | @@ -27,7 +26,7 @@ FURB177.py:6:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr 5 | _ = Path().resolve() 6 | _ = pathlib.Path().resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 -7 | +7 | 8 | _ = Path("").resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` @@ -45,7 +44,7 @@ FURB177.py:6:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr FURB177.py:8:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups | 6 | _ = pathlib.Path().resolve() -7 | +7 | 8 | _ = Path("").resolve() | ^^^^^^^^^^^^^^^^^^ FURB177 9 | _ = pathlib.Path("").resolve() @@ -67,7 +66,7 @@ FURB177.py:9:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr 8 | _ = Path("").resolve() 9 | _ = pathlib.Path("").resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 -10 | +10 | 11 | _ = Path(".").resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` @@ -85,7 +84,7 @@ FURB177.py:9:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for curr FURB177.py:11:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups | 9 | _ = pathlib.Path("").resolve() -10 | +10 | 11 | _ = Path(".").resolve() | ^^^^^^^^^^^^^^^^^^^ FURB177 12 | _ = pathlib.Path(".").resolve() @@ -107,7 +106,7 @@ FURB177.py:12:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 11 | _ = Path(".").resolve() 12 | _ = pathlib.Path(".").resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 -13 | +13 | 14 | _ = Path("", **kwargs).resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` @@ -125,7 +124,7 @@ FURB177.py:12:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur FURB177.py:14:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups | 12 | _ = pathlib.Path(".").resolve() -13 | +13 | 14 | _ = Path("", **kwargs).resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 15 | _ = pathlib.Path("", **kwargs).resolve() @@ -147,7 +146,7 @@ FURB177.py:15:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 14 | _ = Path("", **kwargs).resolve() 15 | _ = pathlib.Path("", **kwargs).resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 -16 | +16 | 17 | _ = Path(".", **kwargs).resolve() | = help: Replace `Path().resolve()` with `Path.cwd()` @@ -165,7 +164,7 @@ FURB177.py:15:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur FURB177.py:17:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups | 15 | _ = pathlib.Path("", **kwargs).resolve() -16 | +16 | 17 | _ = Path(".", **kwargs).resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 18 | _ = pathlib.Path(".", **kwargs).resolve() @@ -187,7 +186,7 @@ FURB177.py:18:5: FURB177 [*] Prefer `Path.cwd()` over `Path().resolve()` for cur 17 | _ = Path(".", **kwargs).resolve() 18 | _ = pathlib.Path(".", **kwargs).resolve() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB177 -19 | +19 | 20 | # OK | = help: Replace `Path().resolve()` with `Path.cwd()` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap index 5ecf72dfa7..45df8c8e53 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB180.py:7:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 5 | # Errors -6 | +6 | 7 | class A0(metaclass=abc.ABCMeta): | ^^^^^^^^^^^^^^^^^^^^^ FURB180 8 | @abstractmethod diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap index f602872c88..82cea760ea 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/refurb/mod.rs FURB181.py:19:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 17 | # these will match -18 | +18 | 19 | blake2b().digest().hex() | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB181 20 | blake2s().digest().hex() @@ -268,7 +268,7 @@ FURB181.py:32:1: FURB181 Use of hashlib's `.digest().hex()` 31 | shake_128().digest(10).hex() 32 | shake_256().digest(10).hex() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB181 -33 | +33 | 34 | hashlib.sha256().digest().hex() | = help: Replace with `.hexdigest()` @@ -276,10 +276,10 @@ FURB181.py:32:1: FURB181 Use of hashlib's `.digest().hex()` FURB181.py:34:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 32 | shake_256().digest(10).hex() -33 | +33 | 34 | hashlib.sha256().digest().hex() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB181 -35 | +35 | 36 | sha256(b"text").digest().hex() | = help: Replace with `.hexdigest()` @@ -297,10 +297,10 @@ FURB181.py:34:1: FURB181 [*] Use of hashlib's `.digest().hex()` FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 34 | hashlib.sha256().digest().hex() -35 | +35 | 36 | sha256(b"text").digest().hex() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB181 -37 | +37 | 38 | hash_algo().digest().hex() | = help: Replace with `.hexdigest()` @@ -318,10 +318,10 @@ FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 36 | sha256(b"text").digest().hex() -37 | +37 | 38 | hash_algo().digest().hex() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB181 -39 | +39 | 40 | # not yet supported | = help: Replace with `.hexdigest()` diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB189_FURB189.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB189_FURB189.py.snap index 714df9487f..43855d425b 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB189_FURB189.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB189_FURB189.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB189.py:17:9: FURB189 [*] Subclassing `dict` can be error prone, use `collections.UserDict` instead | @@ -32,7 +31,7 @@ FURB189.py:17:9: FURB189 [*] Subclassing `dict` can be error prone, use `collect FURB189.py:20:9: FURB189 [*] Subclassing `list` can be error prone, use `collections.UserList` instead | 18 | pass -19 | +19 | 20 | class L(list): | ^^^^ FURB189 21 | pass @@ -52,7 +51,7 @@ FURB189.py:20:9: FURB189 [*] Subclassing `list` can be error prone, use `collect FURB189.py:23:9: FURB189 [*] Subclassing `str` can be error prone, use `collections.UserString` instead | 21 | pass -22 | +22 | 23 | class S(str): | ^^^ FURB189 24 | pass diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap index cebfe0b17f..fdec3718d9 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs -snapshot_kind: text --- FURB192.py:3:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 1 | # Errors -2 | +2 | 3 | sorted(l)[0] | ^^^^^^^^^^^^ FURB192 -4 | +4 | 5 | sorted(l)[-1] | = help: Replace with `min` @@ -25,10 +24,10 @@ FURB192.py:3:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 3 | sorted(l)[0] -4 | +4 | 5 | sorted(l)[-1] | ^^^^^^^^^^^^^ FURB192 -6 | +6 | 7 | sorted(l, reverse=False)[-1] | = help: Replace with `max` @@ -46,10 +45,10 @@ FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 5 | sorted(l)[-1] -6 | +6 | 7 | sorted(l, reverse=False)[-1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB192 -8 | +8 | 9 | sorted(l, key=lambda x: x)[0] | = help: Replace with `max` @@ -67,10 +66,10 @@ FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 7 | sorted(l, reverse=False)[-1] - 8 | + 8 | 9 | sorted(l, key=lambda x: x)[0] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB192 -10 | +10 | 11 | sorted(l, key=key_fn)[0] | = help: Replace with `min` @@ -88,10 +87,10 @@ FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 9 | sorted(l, key=lambda x: x)[0] -10 | +10 | 11 | sorted(l, key=key_fn)[0] | ^^^^^^^^^^^^^^^^^^^^^^^^ FURB192 -12 | +12 | 13 | sorted([1, 2, 3])[0] | = help: Replace with `min` @@ -109,10 +108,10 @@ FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 11 | sorted(l, key=key_fn)[0] -12 | +12 | 13 | sorted([1, 2, 3])[0] | ^^^^^^^^^^^^^^^^^^^^ FURB192 -14 | +14 | 15 | # Unsafe | = help: Replace with `min` @@ -130,10 +129,10 @@ FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 15 | # Unsafe -16 | +16 | 17 | sorted(l, key=key_fn, reverse=True)[-1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB192 -18 | +18 | 19 | sorted(l, reverse=True)[0] | = help: Replace with `min` @@ -151,10 +150,10 @@ FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 17 | sorted(l, key=key_fn, reverse=True)[-1] -18 | +18 | 19 | sorted(l, reverse=True)[0] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB192 -20 | +20 | 21 | sorted(l, reverse=True)[-1] | = help: Replace with `max` @@ -172,10 +171,10 @@ FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 19 | sorted(l, reverse=True)[0] -20 | +20 | 21 | sorted(l, reverse=True)[-1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FURB192 -22 | +22 | 23 | # Non-errors | = help: Replace with `min` 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 a4251d40e3..14b7c0d363 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF005.py:4:1: RUF005 Consider `[*foo]` instead of concatenation | @@ -173,7 +172,7 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co 46 | excitement = ("we all think",) + Fun().yay() 47 | astonishment = ("we all feel",) + Fun.words | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005 -48 | +48 | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) | = help: Replace with `("we all feel", *Fun.words)` @@ -191,10 +190,10 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words -48 | +48 | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005 -50 | +50 | 51 | baz = () + zoob | = help: Replace with iterable unpacking @@ -212,10 +211,10 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words -48 | +48 | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005 -50 | +50 | 51 | baz = () + zoob | = help: Replace with `("yes", "no", "pants", *zoob)` @@ -233,10 +232,10 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) -50 | +50 | 51 | baz = () + zoob | ^^^^^^^^^ RUF005 -52 | +52 | 53 | [] + foo + [ | = help: Replace with `(*zoob,)` @@ -254,11 +253,11 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | 51 | baz = () + zoob -52 | +52 | 53 | / [] + foo + [ 54 | | ] | |_^ RUF005 -55 | +55 | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] | = help: Replace with `[*foo]` @@ -277,7 +276,7 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation | 54 | ] -55 | +55 | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -320,7 +319,7 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) 58 | b = a + [2, 3] + [4] | ^^^^^^^^^^^^^^^^ RUF005 -59 | +59 | 60 | # Uses the non-preferred quote style, which should be retained. | = help: Replace with `[*a, 2, 3, 4]` @@ -340,7 +339,7 @@ RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation 60 | # Uses the non-preferred quote style, which should be retained. 61 | f"{a() + ['b']}" | ^^^^^^^^^^^ RUF005 -62 | +62 | 63 | ### | = help: Replace with `[*a(), 'b']` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap index 707e27a8cd..1df2682c60 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF006_RUF006.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF006.py:6:5: RUF006 Store a reference to the return value of `asyncio.create_task` | @@ -58,7 +57,7 @@ RUF006.py:170:5: RUF006 Store a reference to the return value of `loop.create_ta 169 | loop = asyncio.new_event_loop() 170 | loop.create_task(main()) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF006 -171 | +171 | 172 | # Error | @@ -68,6 +67,6 @@ RUF006.py:175:5: RUF006 Store a reference to the return value of `loop.create_ta 174 | loop = asyncio.get_event_loop() 175 | loop.create_task(main()) # Error | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF006 -176 | +176 | 177 | # OK | 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 969cafe0b7..1910bdf6f9 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 @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF010.py:9:4: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 | ^^^^^^^^ RUF010 -10 | +10 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 | = help: Replace with conversion flag @@ -25,7 +24,7 @@ RUF010.py:9:16: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 | ^^^^^^^^^ RUF010 -10 | +10 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 | = help: Replace with conversion flag @@ -44,7 +43,7 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 | ^^^^^^^^^^ RUF010 -10 | +10 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 | = help: Replace with conversion flag @@ -62,10 +61,10 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag RUF010.py:11:4: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 -10 | +10 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 | ^^^^^^^^^^^ RUF010 -12 | +12 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | = help: Replace with conversion flag @@ -83,10 +82,10 @@ RUF010.py:11:4: RUF010 [*] Use explicit conversion flag RUF010.py:11:19: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 -10 | +10 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 | ^^^^^^^^^^^^ RUF010 -12 | +12 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | = help: Replace with conversion flag @@ -104,10 +103,10 @@ RUF010.py:11:19: RUF010 [*] Use explicit conversion flag RUF010.py:11:35: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 -10 | +10 | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 | ^^^^^^^^^^^^^ RUF010 -12 | +12 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | = help: Replace with conversion flag @@ -125,10 +124,10 @@ RUF010.py:11:35: RUF010 [*] Use explicit conversion flag RUF010.py:13:5: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 -12 | +12 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | ^^^^^^^^ RUF010 -14 | +14 | 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | = help: Replace with conversion flag @@ -146,10 +145,10 @@ RUF010.py:13:5: RUF010 [*] Use explicit conversion flag RUF010.py:13:19: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 -12 | +12 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | ^^^^^^^^^ RUF010 -14 | +14 | 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | = help: Replace with conversion flag @@ -167,10 +166,10 @@ RUF010.py:13:19: RUF010 [*] Use explicit conversion flag RUF010.py:13:34: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 -12 | +12 | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | ^^^^^^^^^^ RUF010 -14 | +14 | 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | = help: Replace with conversion flag @@ -188,10 +187,10 @@ RUF010.py:13:34: RUF010 [*] Use explicit conversion flag RUF010.py:15:14: RUF010 [*] Use explicit conversion flag | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 -14 | +14 | 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | ^^^^^^^^^ RUF010 -16 | +16 | 17 | f"{foo(bla)}" # OK | = help: Replace with conversion flag @@ -209,10 +208,10 @@ RUF010.py:15:14: RUF010 [*] Use explicit conversion flag RUF010.py:15:29: RUF010 [*] Use explicit conversion flag | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 -14 | +14 | 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 | ^^^^^^^^^^ RUF010 -16 | +16 | 17 | f"{foo(bla)}" # OK | = help: Replace with conversion flag diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap index 1f51bb989c..e52bcaa95f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF012_RUF012.py.snap @@ -1,12 +1,10 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -assertion_line: 82 -snapshot_kind: text --- RUF012.py:9:34: RUF012 Mutable class attributes should be annotated with `typing.ClassVar` | 7 | } - 8 | + 8 | 9 | mutable_default: list[int] = [] | ^^ RUF012 10 | immutable_annotation: Sequence[int] = [] @@ -39,6 +37,6 @@ RUF012.py:89:38: RUF012 Mutable class attributes should be annotated with `typin 88 | id: int 89 | mutable_default: list[int] = [] | ^^ RUF012 -90 | +90 | 91 | from sqlmodel import SQLModel | 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 5fbad3a710..e0dcb01a6a 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -69,7 +68,7 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 6 | list(i for i in x)[0] 7 | [i for i in x][0] | ^^^^^^^^^^^^^^^^^ RUF015 -8 | +8 | 9 | # OK (not indexing (solely) the first element) | = help: Replace with `next(iter(x))` @@ -130,7 +129,7 @@ RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single elem 30 | [i for i in x if i > 5][0] 31 | [(i, i + 1) for i in x][0] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF015 -32 | +32 | 33 | # RUF015 (multiple generators) | = help: Replace with `next((i, i + 1) for i in x)` @@ -151,7 +150,7 @@ RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over singl 34 | y = range(10) 35 | [i + j for i in x for j in y][0] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF015 -36 | +36 | 37 | # RUF015 | = help: Replace with `next(i + j for i in x for j in y)` @@ -320,7 +319,7 @@ RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice 46 | | *x.y 47 | | ][0] | |____^ RUF015 -48 | +48 | 49 | # RUF015 (multi-line) | = help: Replace with `next(iter(x.y))` @@ -347,7 +346,7 @@ RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice 53 | | if isinstance(a, ast.Assign) and a.targets[0].id == "REVISION_HEADS_MAP" 54 | | ][0] | |____^ RUF015 -55 | +55 | 56 | # RUF015 (zip) | = help: Replace with `next(...)` @@ -392,7 +391,7 @@ RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice 57 | list(zip(x, y))[0] 58 | [*zip(x, y)][0] | ^^^^^^^^^^^^^^^ RUF015 -59 | +59 | 60 | # RUF015 (pop) | = help: Replace with `next(zip(x, y))` @@ -453,7 +452,7 @@ RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 62 | [i for i in x].pop(0) 63 | list(i for i in x).pop(0) | ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF015 -64 | +64 | 65 | # OK | = help: Replace with `next(iter(x))` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap index 3db5a468c3..32d0727cc8 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF016_RUF016.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF016.py:20:13: RUF016 Indexed access to type `str` uses type `str` instead of an integer or slice | @@ -16,7 +15,7 @@ RUF016.py:21:14: RUF016 Indexed access to type `str` uses type `str` instead of 20 | var = "abc"["x"] 21 | var = f"abc"["x"] | ^^^ RUF016 -22 | +22 | 23 | # Should emit for invalid access on bytes | @@ -25,7 +24,7 @@ RUF016.py:24:14: RUF016 Indexed access to type `bytes` uses type `str` instead o 23 | # Should emit for invalid access on bytes 24 | var = b"abc"["x"] | ^^^ RUF016 -25 | +25 | 26 | # Should emit for invalid access on lists and tuples | @@ -43,7 +42,7 @@ RUF016.py:28:17: RUF016 Indexed access to type `tuple` uses type `str` instead o 27 | var = [1, 2, 3]["x"] 28 | var = (1, 2, 3)["x"] | ^^^ RUF016 -29 | +29 | 30 | # Should emit for invalid access on list comprehensions | @@ -52,7 +51,7 @@ RUF016.py:31:30: RUF016 Indexed access to type `list comprehension` uses type `s 30 | # Should emit for invalid access on list comprehensions 31 | var = [x for x in range(10)]["x"] | ^^^ RUF016 -32 | +32 | 33 | # Should emit for invalid access using tuple | @@ -61,7 +60,7 @@ RUF016.py:34:13: RUF016 Indexed access to type `str` uses type `tuple` instead o 33 | # Should emit for invalid access using tuple 34 | var = "abc"[1, 2] | ^^^^ RUF016 -35 | +35 | 36 | # Should emit for invalid access using string | @@ -70,7 +69,7 @@ RUF016.py:37:14: RUF016 Indexed access to type `list` uses type `str` instead of 36 | # Should emit for invalid access using string 37 | var = [1, 2]["x"] | ^^^ RUF016 -38 | +38 | 39 | # Should emit for invalid access using float | @@ -79,7 +78,7 @@ RUF016.py:40:14: RUF016 Indexed access to type `list` uses type `float` instead 39 | # Should emit for invalid access using float 40 | var = [1, 2][0.25] | ^^^^ RUF016 -41 | +41 | 42 | # Should emit for invalid access using dict | @@ -88,7 +87,7 @@ RUF016.py:43:14: RUF016 Indexed access to type `list` uses type `dict` instead o 42 | # Should emit for invalid access using dict 43 | var = [1, 2][{"x": "y"}] | ^^^^^^^^^^ RUF016 -44 | +44 | 45 | # Should emit for invalid access using dict comp | @@ -97,7 +96,7 @@ RUF016.py:46:14: RUF016 Indexed access to type `list` uses type `dict comprehens 45 | # Should emit for invalid access using dict comp 46 | var = [1, 2][{x: "y" for x in range(2)}] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF016 -47 | +47 | 48 | # Should emit for invalid access using list | @@ -106,7 +105,7 @@ RUF016.py:49:14: RUF016 Indexed access to type `list` uses type `tuple` instead 48 | # Should emit for invalid access using list 49 | var = [1, 2][2, 3] | ^^^^ RUF016 -50 | +50 | 51 | # Should emit for invalid access using list comp | @@ -115,7 +114,7 @@ RUF016.py:52:14: RUF016 Indexed access to type `list` uses type `list comprehens 51 | # Should emit for invalid access using list comp 52 | var = [1, 2][[x for x in range(2)]] | ^^^^^^^^^^^^^^^^^^^^^ RUF016 -53 | +53 | 54 | # Should emit on invalid access using set | @@ -124,7 +123,7 @@ RUF016.py:55:14: RUF016 Indexed access to type `list` uses type `set` instead of 54 | # Should emit on invalid access using set 55 | var = [1, 2][{"x", "y"}] | ^^^^^^^^^^ RUF016 -56 | +56 | 57 | # Should emit on invalid access using set comp | @@ -133,7 +132,7 @@ RUF016.py:58:14: RUF016 Indexed access to type `list` uses type `set comprehensi 57 | # Should emit on invalid access using set comp 58 | var = [1, 2][{x for x in range(2)}] | ^^^^^^^^^^^^^^^^^^^^^ RUF016 -59 | +59 | 60 | # Should emit on invalid access using bytes | @@ -142,7 +141,7 @@ RUF016.py:61:14: RUF016 Indexed access to type `list` uses type `bytes` instead 60 | # Should emit on invalid access using bytes 61 | var = [1, 2][b"x"] | ^^^^ RUF016 -62 | +62 | 63 | # Should emit for non-integer slice start | @@ -210,7 +209,7 @@ RUF016.py:70:17: RUF016 Slice in indexed access to type `list` uses type `list c 69 | var = [1, 2, 3][{"x": x for x in range(2)}:2] 70 | var = [1, 2, 3][[x for x in range(2)]:2] | ^^^^^^^^^^^^^^^^^^^^^ RUF016 -71 | +71 | 72 | # Should emit for non-integer slice end | @@ -278,7 +277,7 @@ RUF016.py:79:19: RUF016 Slice in indexed access to type `list` uses type `list c 78 | var = [1, 2, 3][0:{"x": x for x in range(2)}] 79 | var = [1, 2, 3][0:[x for x in range(2)]] | ^^^^^^^^^^^^^^^^^^^^^ RUF016 -80 | +80 | 81 | # Should emit for non-integer slice step | @@ -346,7 +345,7 @@ RUF016.py:88:21: RUF016 Slice in indexed access to type `list` uses type `list c 87 | var = [1, 2, 3][0:1:{"x": x for x in range(2)}] 88 | var = [1, 2, 3][0:1:[x for x in range(2)]] | ^^^^^^^^^^^^^^^^^^^^^ RUF016 -89 | +89 | 90 | # Should emit for non-integer slice start and end; should emit twice with specific ranges | @@ -355,7 +354,7 @@ RUF016.py:91:17: RUF016 Slice in indexed access to type `list` uses type `str` i 90 | # Should emit for non-integer slice start and end; should emit twice with specific ranges 91 | var = [1, 2, 3]["x":"y"] | ^^^ RUF016 -92 | +92 | 93 | # Should emit once for repeated invalid access | @@ -364,7 +363,7 @@ RUF016.py:91:21: RUF016 Slice in indexed access to type `list` uses type `str` i 90 | # Should emit for non-integer slice start and end; should emit twice with specific ranges 91 | var = [1, 2, 3]["x":"y"] | ^^^ RUF016 -92 | +92 | 93 | # Should emit once for repeated invalid access | @@ -373,6 +372,6 @@ RUF016.py:94:17: RUF016 Indexed access to type `list` uses type `str` instead of 93 | # Should emit once for repeated invalid access 94 | var = [1, 2, 3]["x"]["y"]["z"] | ^^^ RUF016 -95 | +95 | 96 | # Cannot emit on invalid access using variable in index | 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 eaeb9c874d..71be7e5fb5 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation | @@ -110,7 +109,7 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation 9 | / sum([[1, 2, 3], [4, 5, 6]], 10 | | []) | |_______^ RUF017 -11 | +11 | 12 | # OK | = help: Replace with `functools.reduce` @@ -135,7 +134,7 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | 19 | import functools, operator -20 | +20 | 21 | sum([x, y], []) | ^^^^^^^^^^^^^^^ RUF017 | 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 22702a5c56..24416b08b7 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access | @@ -43,7 +42,7 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access | 8 | pass - 9 | + 9 | 10 | if (k) in d and d[k]: | ^^^^^^^^^^^^^^^^^ RUF019 11 | pass @@ -63,7 +62,7 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access | 11 | pass -12 | +12 | 13 | if k in d and d[(k)]: | ^^^^^^^^^^^^^^^^^ RUF019 14 | pass @@ -83,10 +82,10 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access | 14 | pass -15 | +15 | 16 | not ("key" in dct and dct["key"]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF019 -17 | +17 | 18 | bool("key" in dct and dct["key"]) | = help: Replace with `dict.get` @@ -104,10 +103,10 @@ RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access | 16 | not ("key" in dct and dct["key"]) -17 | +17 | 18 | bool("key" in dct and dct["key"]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF019 -19 | +19 | 20 | # OK | = help: Replace with `dict.get` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap index 8163d3d72c..93eccd0055 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/ruff/mod.rs RUF020.py:3:7: RUF020 [*] `Union[Never, T]` is equivalent to `T` | 1 | from typing import Never, NoReturn, Union -2 | +2 | 3 | Union[Never, int] | ^^^^^ RUF020 4 | Union[NoReturn, int] @@ -168,7 +168,7 @@ RUF020.py:14:12: RUF020 `Never | T` is equivalent to `T` 13 | y: (None | Never) | None 14 | z: None | (Never | None) | ^^^^^ RUF020 -15 | +15 | 16 | a: int | Never | None | = help: Remove `Never` @@ -176,7 +176,7 @@ RUF020.py:14:12: RUF020 `Never | T` is equivalent to `T` RUF020.py:16:10: RUF020 `Never | T` is equivalent to `T` | 14 | z: None | (Never | None) -15 | +15 | 16 | a: int | Never | None | ^^^^^ RUF020 17 | b: Never | Never | None diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap index 300a19e072..5239070ff1 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF021.py:12:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | @@ -27,7 +26,7 @@ RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 12 | x = a or b and c # RUF021: => `a or (b and c)` 13 | x = a or b and c # looooooooooooooooooooooooooooooong comment but it won't prevent an autofix | ^^^^^^^ RUF021 -14 | +14 | 15 | a, b, c = 0, 1, 2 | = help: Parenthesize the `and` subexpression @@ -47,7 +46,7 @@ RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 15 | a, b, c = 0, 1, 2 16 | y = a and b or c # RUF021: => `(a and b) or c` | ^^^^^^^ RUF021 -17 | +17 | 18 | a, b, c, d = 1, 2, 0, 3 | = help: Parenthesize the `and` subexpression @@ -145,7 +144,7 @@ RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 34 | # RUF021: => `a or b or c or (d and e)`: 35 | z = [a for a in range(5) if a or b or c or d and e] | ^^^^^^^ RUF021 -36 | +36 | 37 | a, b, c, d = 0, 1, 3, 0 | = help: Parenthesize the `and` subexpression @@ -165,7 +164,7 @@ RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 37 | a, b, c, d = 0, 1, 3, 0 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` | ^^^^^^^^^^^ RUF021 -39 | +39 | 40 | if (not a) and b or c or d: # RUF021: => `((not a) and b) or c or d` | = help: Parenthesize the `and` subexpression @@ -183,7 +182,7 @@ RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` -39 | +39 | 40 | if (not a) and b or c or d: # RUF021: => `((not a) and b) or c or d` | ^^^^^^^^^^^^^ RUF021 41 | if (not a and b) or c or d: # OK diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap index aee3f36be6..452195dad7 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap @@ -26,7 +26,7 @@ RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted 6 | __slots__ = ["d", "c", "b", "a"] # a comment that is untouched 7 | __slots__ = ("d", "c", "b", "a") | ^^^^^^^^^^^^^^^^^^^^ RUF023 -8 | +8 | 9 | # Quoting style is retained, | = help: Apply a natural sort to `Klass.__slots__` @@ -68,7 +68,7 @@ RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted 13 | # (but they are in multiline definitions) 14 | __slots__: tuple = ("b", "c", "a",) | ^^^^^^^^^^^^^^^^ RUF023 -15 | +15 | 16 | class Klass2: | = help: Apply a natural sort to `Klass.__slots__` @@ -110,7 +110,7 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted 19 | else: 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) | ^^^^^^^^^^^^^^^^^^^^^^ RUF023 -21 | +21 | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] | = help: Apply a natural sort to `Klass2.__slots__` @@ -128,7 +128,7 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted | 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) -21 | +21 | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -172,7 +172,7 @@ RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted 25 | # not alphabetical sort or "isort-style" sort 26 | __slots__ = {"aadvark237", "aadvark10092", "aadvark174", "aadvark532"} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 -27 | +27 | 28 | ############################ | = help: Apply a natural sort to `Klass2.__slots__` @@ -234,7 +234,7 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted 45 | | "a" 46 | | ] | |_____^ RUF023 -47 | +47 | 48 | ################################## | = help: Apply a natural sort to `Klass3.__slots__` @@ -299,7 +299,7 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted | 62 | # comment7 -63 | +63 | 64 | __slots__ = [ # comment0 | _________________^ 65 | | # comment1 @@ -310,7 +310,7 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted 70 | | # comment6 71 | | ] # comment7 | |_____^ RUF023 -72 | +72 | 73 | # from cpython/Lib/pathlib/__init__.py | = help: Apply a natural sort to `Klass4.__slots__` @@ -339,7 +339,7 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted 76 | | # The `_raw_paths` slot stores unnormalized string paths. This is set 77 | | # in the `__init__()` method. 78 | | '_raw_paths', - 79 | | + 79 | | 80 | | # The `_drv`, `_root` and `_tail_cached` slots store parsed and 81 | | # normalized parts of the path. They are set when any of the `drive`, 82 | | # `root` or `_tail` properties are accessed for the first time. The @@ -348,30 +348,30 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted 85 | | # separators (i.e. it is a list of strings), and that the root and 86 | | # tail are normalized. 87 | | '_drv', '_root', '_tail_cached', - 88 | | + 88 | | 89 | | # The `_str` slot stores the string representation of the path, 90 | | # computed from the drive, root and tail when `__str__()` is called 91 | | # for the first time. It's used to implement `_str_normcase` 92 | | '_str', - 93 | | + 93 | | 94 | | # The `_str_normcase_cached` slot stores the string path with 95 | | # normalized case. It is set when the `_str_normcase` property is 96 | | # accessed for the first time. It's used to implement `__eq__()` 97 | | # `__hash__()`, and `_parts_normcase` 98 | | '_str_normcase_cached', - 99 | | + 99 | | 100 | | # The `_parts_normcase_cached` slot stores the case-normalized 101 | | # string path after splitting on path separators. It's set when the 102 | | # `_parts_normcase` property is accessed for the first time. It's used 103 | | # to implement comparison methods like `__lt__()`. 104 | | '_parts_normcase_cached', -105 | | +105 | | 106 | | # The `_hash` slot stores the hash of the case-normalized string 107 | | # path. It's set when `__hash__()` is called for the first time. 108 | | '_hash', 109 | | ) | |_____^ RUF023 -110 | +110 | 111 | # From cpython/Lib/pickletools.py | = help: Apply a natural sort to `PurePath.__slots__` @@ -439,22 +439,22 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted | _________________^ 114 | | # name of descriptor record, also a module global name; a string 115 | | 'name', -116 | | +116 | | 117 | | # length of argument, in bytes; an int; UP_TO_NEWLINE and 118 | | # TAKEN_FROM_ARGUMENT{1,4,8} are negative values for variable-length 119 | | # cases 120 | | 'n', -121 | | +121 | | 122 | | # a function taking a file-like object, reading this kind of argument 123 | | # from the object at the current position, advancing the current 124 | | # position by n bytes, and returning the value of the argument 125 | | 'reader', -126 | | +126 | | 127 | | # human-readable docs for this arg descriptor; a string 128 | | 'doc', 129 | | ) | |_____^ RUF023 -130 | +130 | 131 | #################################### | = help: Apply a natural sort to `ArgumentDescriptor.__slots__` @@ -494,7 +494,7 @@ RUF023.py:138:17: RUF023 `SlotUser.__slots__` is not sorted | _________________^ 139 | | 'distance': 'measured in kilometers'} | |______________________________________________________^ RUF023 -140 | +140 | 141 | class Klass5: | = help: Apply a natural sort to `SlotUser.__slots__` @@ -538,7 +538,7 @@ RUF023.py:155:17: RUF023 `Klass5.__slots__` is not sorted 154 | ) 155 | __slots__ = ("don't" "care" "about", "__slots__" "with", "concatenated" "strings") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF023 -156 | +156 | 157 | ############################################################ | = help: Apply a natural sort to `Klass5.__slots__` @@ -550,7 +550,7 @@ RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted | _________________^ 163 | | 'canvas',) | |___________________________^ RUF023 -164 | +164 | 165 | class BezierBuilder2: | = help: Apply a natural sort to `BezierBuilder.__slots__` @@ -577,7 +577,7 @@ RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted | _________________^ 167 | | 'canvas' , } | |___________________________________________^ RUF023 -168 | +168 | 169 | class BezierBuilder3: | = help: Apply a natural sort to `BezierBuilder2.__slots__` @@ -602,15 +602,15 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted 170 | __slots__ = ['xp', 'yp', | _________________^ 171 | | 'canvas' -172 | | +172 | | 173 | | # very strangely placed comment -174 | | +174 | | 175 | | , -176 | | +176 | | 177 | | # another strangely placed comment 178 | | ] | |__________________^ RUF023 -179 | +179 | 180 | class BezierBuilder4: | = help: Apply a natural sort to `BezierBuilder3.__slots__` @@ -643,7 +643,7 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 188 | | , 189 | | ) | |_____^ RUF023 -190 | +190 | 191 | __slots__ = {"foo", "bar", | = help: Apply a natural sort to `BezierBuilder4.__slots__` @@ -666,7 +666,7 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | 189 | ) -190 | +190 | 191 | __slots__ = {"foo", "bar", | _________________^ 192 | | "baz", "bingo" diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap index df1bc34856..4c361c8639 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF024.py:9:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -133,7 +132,7 @@ RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 15 | import builtins 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF024 -17 | +17 | 18 | # Okay. | = help: Replace with comprehension diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap index f7d533bd90..2973ba2930 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF027_0.py:5:7: RUF027 [*] Possible f-string without an `f` prefix | 3 | "always ignore this: {val}" -4 | +4 | 5 | print("but don't ignore this: {val}") # RUF027 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF027 | @@ -286,7 +285,7 @@ RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix 69 | last = "Appleseed" 70 | value.method("{first} {last}") # RUF027 | ^^^^^^^^^^^^^^^^ RUF027 -71 | +71 | 72 | def format_specifiers(): | = help: Add `f` prefix diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap index 04049505ec..8b6a2c3935 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap @@ -7,7 +7,7 @@ RUF030.py:6:14: RUF030 [*] `print()` call in `assert` statement is likely uninte 5 | # - single StringLiteral 6 | assert True, print("This print is not intentional.") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -7 | +7 | 8 | # Concatenated string literals | = help: Remove `print` @@ -28,7 +28,7 @@ RUF030.py:11:14: RUF030 [*] `print()` call in `assert` statement is likely unint 10 | # - single StringLiteral 11 | assert True, print("This print" " is not intentional.") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -12 | +12 | 13 | # Positional arguments, string literals | = help: Remove `print` @@ -49,7 +49,7 @@ RUF030.py:16:14: RUF030 [*] `print()` call in `assert` statement is likely unint 15 | # - single StringLiteral concatenated with " " 16 | assert True, print("This print", "is not intentional") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -17 | +17 | 18 | # Concatenated string literals combined with Positional arguments | = help: Remove `print` @@ -70,7 +70,7 @@ RUF030.py:21:14: RUF030 [*] `print()` call in `assert` statement is likely unint 20 | # - single stringliteral concatenated with " " only between `print` and `is` 21 | assert True, print("This " "print", "is not intentional.") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -22 | +22 | 23 | # Positional arguments, string literals with a variable | = help: Remove `print` @@ -91,7 +91,7 @@ RUF030.py:26:14: RUF030 [*] `print()` call in `assert` statement is likely unint 25 | # - single FString concatenated with " " 26 | assert True, print("This", print.__name__, "is not intentional.") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -27 | +27 | 28 | # Mixed brackets string literals | = help: Remove `print` @@ -112,7 +112,7 @@ RUF030.py:31:14: RUF030 [*] `print()` call in `assert` statement is likely unint 30 | # - single StringLiteral concatenated with " " 31 | assert True, print("This print", 'is not intentional', """and should be removed""") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -32 | +32 | 33 | # Mixed brackets with other brackets inside | = help: Remove `print` @@ -133,7 +133,7 @@ RUF030.py:36:14: RUF030 [*] `print()` call in `assert` statement is likely unint 35 | # - single StringLiteral concatenated with " " and escaped brackets 36 | assert True, print("This print", 'is not "intentional"', """and "should" be 'removed'""") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -37 | +37 | 38 | # Positional arguments, string literals with a separator | = help: Remove `print` @@ -154,7 +154,7 @@ RUF030.py:41:14: RUF030 [*] `print()` call in `assert` statement is likely unint 40 | # - single StringLiteral concatenated with "|" 41 | assert True, print("This print", "is not intentional", sep="|") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -42 | +42 | 43 | # Positional arguments, string literals with None as separator | = help: Remove `print` @@ -175,7 +175,7 @@ RUF030.py:46:14: RUF030 [*] `print()` call in `assert` statement is likely unint 45 | # - single StringLiteral concatenated with " " 46 | assert True, print("This print", "is not intentional", sep=None) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -47 | +47 | 48 | # Positional arguments, string literals with variable as separator, needs f-string | = help: Remove `print` @@ -196,7 +196,7 @@ RUF030.py:51:14: RUF030 [*] `print()` call in `assert` statement is likely unint 50 | # - single FString concatenated with "{U00A0}" 51 | assert True, print("This print", "is not intentional", sep=U00A0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -52 | +52 | 53 | # Unnecessary f-string | = help: Remove `print` @@ -217,7 +217,7 @@ RUF030.py:56:14: RUF030 [*] `print()` call in `assert` statement is likely unint 55 | # - single StringLiteral 56 | assert True, print(f"This f-string is just a literal.") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -57 | +57 | 58 | # Positional arguments, string literals and f-strings | = help: Remove `print` @@ -238,7 +238,7 @@ RUF030.py:61:14: RUF030 [*] `print()` call in `assert` statement is likely unint 60 | # - single FString concatenated with " " 61 | assert True, print("This print", f"is not {'intentional':s}") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -62 | +62 | 63 | # Positional arguments, string literals and f-strings with a separator | = help: Remove `print` @@ -259,7 +259,7 @@ RUF030.py:66:14: RUF030 [*] `print()` call in `assert` statement is likely unint 65 | # - single FString concatenated with "|" 66 | assert True, print("This print", f"is not {'intentional':s}", sep="|") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -67 | +67 | 68 | # A single f-string | = help: Remove `print` @@ -280,7 +280,7 @@ RUF030.py:71:14: RUF030 [*] `print()` call in `assert` statement is likely unint 70 | # - single FString 71 | assert True, print(f"This print is not {'intentional':s}") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -72 | +72 | 73 | # A single f-string with a redundant separator | = help: Remove `print` @@ -301,7 +301,7 @@ RUF030.py:76:14: RUF030 [*] `print()` call in `assert` statement is likely unint 75 | # - single FString 76 | assert True, print(f"This print is not {'intentional':s}", sep="|") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -77 | +77 | 78 | # Complex f-string with variable as separator | = help: Remove `print` @@ -322,7 +322,7 @@ RUF030.py:83:14: RUF030 [*] `print()` call in `assert` statement is likely unint 82 | maintainer = "John Doe" 83 | assert True, print("Unreachable due to", condition, f", ask {maintainer} for advice", sep=U00A0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 -84 | +84 | 85 | # Empty print | = help: Remove `print` @@ -343,7 +343,7 @@ RUF030.py:88:14: RUF030 [*] `print()` call in `assert` statement is likely unint 87 | # - `msg` entirely removed from assertion 88 | assert True, print() | ^^^^^^^ RUF030 -89 | +89 | 90 | # Empty print with separator | = help: Remove `print` @@ -364,7 +364,7 @@ RUF030.py:93:14: RUF030 [*] `print()` call in `assert` statement is likely unint 92 | # - `msg` entirely removed from assertion 93 | assert True, print(sep=" ") | ^^^^^^^^^^^^^^ RUF030 -94 | +94 | 95 | # Custom print function that actually returns a string | = help: Remove `print` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap index 68f0960074..3c1b4128b7 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF031_RUF031.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF031.py:2:3: RUF031 [*] Avoid parentheses for tuples in subscripts | @@ -177,7 +176,7 @@ RUF031.py:36:3: RUF031 [*] Avoid parentheses for tuples in subscripts 35 | # https://github.com/astral-sh/ruff/issues/12776 36 | d[(*foo,bar)] | ^^^^^^^^^^ RUF031 -37 | +37 | 38 | x: dict[str, int] # tuples inside type annotations should never be altered | = help: Remove parentheses diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap index 626a673032..98e940a88a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF032_RUF032.py.snap @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF032.py:6:17: RUF032 [*] `Decimal()` called with float literal argument | 4 | decimal.Decimal(0) -5 | +5 | 6 | decimal.Decimal(0.0) # Should error | ^^^ RUF032 -7 | +7 | 8 | decimal.Decimal("0.0") | = help: Replace with string literal @@ -26,10 +25,10 @@ RUF032.py:6:17: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:12:17: RUF032 [*] `Decimal()` called with float literal argument | 10 | decimal.Decimal(10) -11 | +11 | 12 | decimal.Decimal(10.0) # Should error | ^^^^ RUF032 -13 | +13 | 14 | decimal.Decimal("10.0") | = help: Replace with string literal @@ -47,10 +46,10 @@ RUF032.py:12:17: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:18:17: RUF032 [*] `Decimal()` called with float literal argument | 16 | decimal.Decimal(-10) -17 | +17 | 18 | decimal.Decimal(-10.0) # Should error | ^^^^^ RUF032 -19 | +19 | 20 | decimal.Decimal("-10.0") | = help: Replace with string literal @@ -68,10 +67,10 @@ RUF032.py:18:17: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:33:15: RUF032 [*] `Decimal()` called with float literal argument | 31 | val = Decimal(0) -32 | +32 | 33 | val = Decimal(0.0) # Should error | ^^^ RUF032 -34 | +34 | 35 | val = Decimal("0.0") | = help: Replace with string literal @@ -89,10 +88,10 @@ RUF032.py:33:15: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:39:15: RUF032 [*] `Decimal()` called with float literal argument | 37 | val = Decimal(10) -38 | +38 | 39 | val = Decimal(10.0) # Should error | ^^^^ RUF032 -40 | +40 | 41 | val = Decimal("10.0") | = help: Replace with string literal @@ -110,10 +109,10 @@ RUF032.py:39:15: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:45:15: RUF032 [*] `Decimal()` called with float literal argument | 43 | val = Decimal(-10) -44 | +44 | 45 | val = Decimal(-10.0) # Should error | ^^^^^ RUF032 -46 | +46 | 47 | val = Decimal("-10.0") | = help: Replace with string literal @@ -131,10 +130,10 @@ RUF032.py:45:15: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:56:15: RUF032 [*] `Decimal()` called with float literal argument | 54 | val = Decimal(~4.0) # Skip -55 | +55 | 56 | val = Decimal(++4.0) # Suggest `Decimal("4.0")` | ^^^^^ RUF032 -57 | +57 | 58 | val = Decimal(-+--++--4.0) # Suggest `Decimal("-4.0")` | = help: Replace with string literal @@ -152,7 +151,7 @@ RUF032.py:56:15: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:58:15: RUF032 [*] `Decimal()` called with float literal argument | 56 | val = Decimal(++4.0) # Suggest `Decimal("4.0")` -57 | +57 | 58 | val = Decimal(-+--++--4.0) # Suggest `Decimal("-4.0")` | ^^^^^^^^^^^ RUF032 | @@ -171,10 +170,10 @@ RUF032.py:58:15: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:88:23: RUF032 [*] `Decimal()` called with float literal argument | 86 | # Retest with fully qualified import -87 | +87 | 88 | val = decimal.Decimal(0.0) # Should error | ^^^ RUF032 -89 | +89 | 90 | val = decimal.Decimal("0.0") | = help: Replace with string literal @@ -192,10 +191,10 @@ RUF032.py:88:23: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:92:23: RUF032 [*] `Decimal()` called with float literal argument | 90 | val = decimal.Decimal("0.0") -91 | +91 | 92 | val = decimal.Decimal(10.0) # Should error | ^^^^ RUF032 -93 | +93 | 94 | val = decimal.Decimal("10.0") | = help: Replace with string literal @@ -213,10 +212,10 @@ RUF032.py:92:23: RUF032 [*] `Decimal()` called with float literal argument RUF032.py:96:23: RUF032 [*] `Decimal()` called with float literal argument | 94 | val = decimal.Decimal("10.0") -95 | +95 | 96 | val = decimal.Decimal(-10.0) # Should error | ^^^^^ RUF032 -97 | +97 | 98 | val = decimal.Decimal("-10.0") | = help: Replace with string literal diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF033_RUF033.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF033_RUF033.py.snap index fe62f6c915..073ab755a9 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF033_RUF033.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF033_RUF033.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF033.py:19:35: RUF033 `__post_init__` method with argument defaults | 17 | baz: InitVar[int] = 1 -18 | +18 | 19 | def __post_init__(self, bar = 11, baz = 11) -> None: ... | ^^ RUF033 | @@ -14,7 +13,7 @@ RUF033.py:19:35: RUF033 `__post_init__` method with argument defaults RUF033.py:19:45: RUF033 `__post_init__` method with argument defaults | 17 | baz: InitVar[int] = 1 -18 | +18 | 19 | def __post_init__(self, bar = 11, baz = 11) -> None: ... | ^^ RUF033 | @@ -103,7 +102,7 @@ RUF033.py:46:78: RUF033 [*] `__post_init__` method with argument defaults RUF033.py:59:40: RUF033 [*] `__post_init__` method with argument defaults | 57 | ping = "pong" -58 | +58 | 59 | def __post_init__(self, bar: int = 11, baz: int = 12) -> None: ... | ^^ RUF033 | @@ -123,7 +122,7 @@ RUF033.py:59:40: RUF033 [*] `__post_init__` method with argument defaults RUF033.py:59:55: RUF033 [*] `__post_init__` method with argument defaults | 57 | ping = "pong" -58 | +58 | 59 | def __post_init__(self, bar: int = 11, baz: int = 12) -> None: ... | ^^ RUF033 | @@ -143,7 +142,7 @@ RUF033.py:59:55: RUF033 [*] `__post_init__` method with argument defaults RUF033.py:67:40: RUF033 `__post_init__` method with argument defaults | 65 | bar = "should've used attrs" -66 | +66 | 67 | def __post_init__(self, bar: str = "ahhh", baz: str = "hmm") -> None: ... | ^^^^^^ RUF033 | @@ -152,7 +151,7 @@ RUF033.py:67:40: RUF033 `__post_init__` method with argument defaults RUF033.py:67:59: RUF033 `__post_init__` method with argument defaults | 65 | bar = "should've used attrs" -66 | +66 | 67 | def __post_init__(self, bar: str = "ahhh", baz: str = "hmm") -> None: ... | ^^^^^ RUF033 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF034_RUF034.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF034_RUF034.py.snap index c045532ca5..769e8dbce1 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF034_RUF034.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF034_RUF034.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF034.py:5:5: RUF034 Useless `if`-`else` condition | 4 | # Invalid 5 | x = 1 if True else 1 | ^^^^^^^^^^^^^^^^ RUF034 -6 | +6 | 7 | # Invalid | @@ -16,7 +15,7 @@ RUF034.py:8:5: RUF034 Useless `if`-`else` condition 7 | # Invalid 8 | x = "a" if True else "a" | ^^^^^^^^^^^^^^^^^^^^ RUF034 - 9 | + 9 | 10 | # Invalid | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF036_RUF036.pyi.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF036_RUF036.pyi.snap index e678092721..64bb14120a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF036_RUF036.pyi.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF036_RUF036.pyi.snap @@ -1,81 +1,80 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF036.pyi:4:16: RUF036 `None` not at the end of the type annotation. | 4 | def func1(arg: None | int): ... | ^^^^ RUF036 -5 | +5 | 6 | def func2() -> None | int: ... | RUF036.pyi:6:16: RUF036 `None` not at the end of the type annotation. | 4 | def func1(arg: None | int): ... -5 | +5 | 6 | def func2() -> None | int: ... | ^^^^ RUF036 -7 | +7 | 8 | def func3(arg: None | None | int): ... | RUF036.pyi:8:16: RUF036 `None` not at the end of the type annotation. | 6 | def func2() -> None | int: ... - 7 | + 7 | 8 | def func3(arg: None | None | int): ... | ^^^^ RUF036 - 9 | + 9 | 10 | def func4(arg: U[None, int]): ... | RUF036.pyi:8:23: RUF036 `None` not at the end of the type annotation. | 6 | def func2() -> None | int: ... - 7 | + 7 | 8 | def func3(arg: None | None | int): ... | ^^^^ RUF036 - 9 | + 9 | 10 | def func4(arg: U[None, int]): ... | RUF036.pyi:10:18: RUF036 `None` not at the end of the type annotation. | 8 | def func3(arg: None | None | int): ... - 9 | + 9 | 10 | def func4(arg: U[None, int]): ... | ^^^^ RUF036 -11 | +11 | 12 | def func5() -> U[None, int]: ... | RUF036.pyi:12:18: RUF036 `None` not at the end of the type annotation. | 10 | def func4(arg: U[None, int]): ... -11 | +11 | 12 | def func5() -> U[None, int]: ... | ^^^^ RUF036 -13 | +13 | 14 | def func6(arg: U[None, None, int]): ... | RUF036.pyi:14:18: RUF036 `None` not at the end of the type annotation. | 12 | def func5() -> U[None, int]: ... -13 | +13 | 14 | def func6(arg: U[None, None, int]): ... | ^^^^ RUF036 -15 | +15 | 16 | # Ok | RUF036.pyi:14:24: RUF036 `None` not at the end of the type annotation. | 12 | def func5() -> U[None, int]: ... -13 | +13 | 14 | def func6(arg: U[None, None, int]): ... | ^^^^ RUF036 -15 | +15 | 16 | # Ok | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF038_RUF038.pyi.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF038_RUF038.pyi.snap index d6d6d902ab..ec4ffb9e79 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF038_RUF038.pyi.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF038_RUF038.pyi.snap @@ -5,7 +5,7 @@ RUF038.pyi:4:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` | 4 | def func1(arg1: Literal[True, False]): ... | ^^^^^^^^^^^^^^^^^^^^ RUF038 -5 | +5 | 6 | def func2(arg1: Literal[True, False, True]): ... | = help: Replace with `bool` @@ -23,10 +23,10 @@ RUF038.pyi:4:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` RUF038.pyi:6:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` | 4 | def func1(arg1: Literal[True, False]): ... -5 | +5 | 6 | def func2(arg1: Literal[True, False, True]): ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF038 -7 | +7 | 8 | def func3() -> Literal[True, False]: ... | = help: Replace with `bool` @@ -44,10 +44,10 @@ RUF038.pyi:6:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` RUF038.pyi:8:16: RUF038 [*] `Literal[True, False]` can be replaced with `bool` | 6 | def func2(arg1: Literal[True, False, True]): ... - 7 | + 7 | 8 | def func3() -> Literal[True, False]: ... | ^^^^^^^^^^^^^^^^^^^^ RUF038 - 9 | + 9 | 10 | def func4(arg1: Literal[True, False] | bool): ... | = help: Replace with `bool` @@ -65,10 +65,10 @@ RUF038.pyi:8:16: RUF038 [*] `Literal[True, False]` can be replaced with `bool` RUF038.pyi:10:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` | 8 | def func3() -> Literal[True, False]: ... - 9 | + 9 | 10 | def func4(arg1: Literal[True, False] | bool): ... | ^^^^^^^^^^^^^^^^^^^^ RUF038 -11 | +11 | 12 | def func5(arg1: Literal[False, True]): ... | = help: Replace with `bool` @@ -86,10 +86,10 @@ RUF038.pyi:10:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` RUF038.pyi:12:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` | 10 | def func4(arg1: Literal[True, False] | bool): ... -11 | +11 | 12 | def func5(arg1: Literal[False, True]): ... | ^^^^^^^^^^^^^^^^^^^^ RUF038 -13 | +13 | 14 | def func6(arg1: Literal[True, False, "hello", "world"]): ... | = help: Replace with `bool` @@ -107,10 +107,10 @@ RUF038.pyi:12:17: RUF038 [*] `Literal[True, False]` can be replaced with `bool` RUF038.pyi:14:17: RUF038 `Literal[True, False, ...]` can be replaced with `Literal[...] | bool` | 12 | def func5(arg1: Literal[False, True]): ... -13 | +13 | 14 | def func6(arg1: Literal[True, False, "hello", "world"]): ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF038 -15 | +15 | 16 | # ok | = help: Replace with `Literal[...] | bool` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF040_RUF040.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF040_RUF040.py.snap index bbac23424e..4102fe32b8 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF040_RUF040.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF040_RUF040.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF040.py:3:21: RUF040 Non-string literal used as assert message | @@ -8,6 +7,6 @@ RUF040.py:3:21: RUF040 Non-string literal used as assert message 2 | fruits.filter(lambda fruit: fruit.startwith("p")) 3 | assert len(fruits), 2 | ^ RUF040 -4 | +4 | 5 | assert True, "always true" | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.py.snap index 83e59df5ea..d09f2bde4e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF041.py:6:4: RUF041 [*] Unnecessary nested `Literal` | @@ -136,7 +135,7 @@ RUF041.py:12:1: RUF041 [*] Unnecessary nested `Literal` 16 | | ] 17 | | ] # once | |_^ RUF041 -18 | +18 | 19 | # Ensure issue is only raised once, even on nested literals | = help: Replace with flattened `Literal` @@ -161,7 +160,7 @@ RUF041.py:20:10: RUF041 [*] Unnecessary nested `Literal` 19 | # Ensure issue is only raised once, even on nested literals 20 | MyType = Literal["foo", Literal[True, False, True], "bar"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF041 -21 | +21 | 22 | # nested literals, all equivalent to `Literal[1]` | = help: Replace with flattened `Literal` @@ -222,7 +221,7 @@ RUF041.py:25:1: RUF041 [*] Unnecessary nested `Literal` 24 | Literal[Literal[Literal[1], Literal[1]]] 25 | Literal[Literal[1], Literal[Literal[Literal[1]]]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF041 -26 | +26 | 27 | # OK | = help: Replace with flattened `Literal` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.pyi.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.pyi.snap index faf9638519..6b146bdc64 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.pyi.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF041_RUF041.pyi.snap @@ -135,7 +135,7 @@ RUF041.pyi:12:1: RUF041 [*] Unnecessary nested `Literal` 16 | | ] 17 | | ] # once | |_^ RUF041 -18 | +18 | 19 | # Ensure issue is only raised once, even on nested literals | = help: Replace with flattened `Literal` @@ -160,7 +160,7 @@ RUF041.pyi:20:10: RUF041 [*] Unnecessary nested `Literal` 19 | # Ensure issue is only raised once, even on nested literals 20 | MyType = Literal["foo", Literal[True, False, True], "bar"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF041 -21 | +21 | 22 | # nested literals, all equivalent to `Literal[1]` | = help: Replace with flattened `Literal` @@ -221,7 +221,7 @@ RUF041.pyi:25:1: RUF041 [*] Unnecessary nested `Literal` 24 | Literal[Literal[Literal[1], Literal[1]]] 25 | Literal[Literal[1], Literal[Literal[Literal[1]]]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF041 -26 | +26 | 27 | # OK | = help: Replace with flattened `Literal` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF052_RUF052.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF052_RUF052.py.snap index 64e4615f20..5fa3f25bc2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF052_RUF052.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF052_RUF052.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF052.py:92:9: RUF052 [*] Local dummy variable `_var` is accessed | @@ -153,7 +152,7 @@ RUF052.py:145:9: RUF052 Local dummy variable `_local` is accessed RUF052.py:153:5: RUF052 [*] Local dummy variable `_P` is accessed | 151 | from collections import namedtuple -152 | +152 | 153 | _P = ParamSpec("_P") | ^^ RUF052 154 | _T = TypeVar(name="_T", covariant=True, bound=int|str) @@ -349,7 +348,7 @@ RUF052.py:160:5: RUF052 [*] Local dummy variable `_NotADynamicClass` is accessed 159 | _DynamicClass = type("_DynamicClass", (), {}) 160 | _NotADynamicClass = type("_NotADynamicClass") | ^^^^^^^^^^^^^^^^^ RUF052 -161 | +161 | 162 | print(_T, _P, _NT, _E, _NT2, _NT3, _DynamicClass, _NotADynamicClass) | = help: Remove leading underscores diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF056_RUF056.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF056_RUF056.py.snap index 0532ef08e6..c269084fef 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF056_RUF056.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF056_RUF056.py.snap @@ -1,13 +1,12 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF056.py:117:43: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in boolean test positions. The default fallback `None` is already falsy. | 116 | # dict.get in ternary expression 117 | value = "not found" if my_dict.get("key", False) else "default" # [RUF056] | ^^^^^ RUF056 -118 | +118 | 119 | # dict.get in an if statement | = help: Remove falsy fallback from `dict.get()` @@ -63,7 +62,7 @@ RUF056.py:124:32: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in RUF056.py:127:23: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in boolean test positions. The default fallback `None` is already falsy. | 125 | pass -126 | +126 | 127 | if my_dict.get("key", False) or True: # [RUF056] | ^^^^^ RUF056 128 | pass @@ -85,7 +84,7 @@ RUF056.py:131:27: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in 130 | # dict.get in an assert statement 131 | assert my_dict.get("key", False) # [RUF056] | ^^^^^ RUF056 -132 | +132 | 133 | # dict.get in a while statement | = help: Remove falsy fallback from `dict.get()` @@ -124,7 +123,7 @@ RUF056.py:138:32: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in 137 | # dict.get in unary not expression 138 | value = not my_dict.get("key", False) # [RUF056] | ^^^^^ RUF056 -139 | +139 | 140 | # testing all falsy fallbacks | = help: Remove falsy fallback from `dict.get()` @@ -332,7 +331,7 @@ RUF056.py:150:32: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in 149 | value = not my_dict.get("key", 0.0) # [RUF056] 150 | value = not my_dict.get("key", "") # [RUF056] | ^^ RUF056 -151 | +151 | 152 | # testing dict.get call using kwargs | = help: Remove falsy fallback from `dict.get()` @@ -372,7 +371,7 @@ RUF056.py:154:25: RUF056 [*] Avoid providing a falsy fallback to `dict.get()` in 153 | value = not my_dict.get(key="key", default=False) # [RUF056] 154 | value = not my_dict.get(default=[], key="key") # [RUF056] | ^^^^^^^^^^ RUF056 -155 | +155 | 156 | # testing invalid dict.get call with inline comment | = help: Remove falsy fallback from `dict.get()` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101_1.py.snap index 101987e969..2b1d4b2b8b 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101_1.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF101_1.py:5:15: RUF101 [*] `TCH002` is a redirect to `TC002` | @@ -8,7 +7,7 @@ RUF101_1.py:5:15: RUF101 [*] `TCH002` is a redirect to `TC002` 4 | """ 5 | # ruff: noqa: TCH002 | ^^^^^^ RUF101 -6 | +6 | 7 | from __future__ import annotations | = help: Replace with `TC002` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap index 2285d405cf..bc93398cdf 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__confusables.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- confusables.py:1:6: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? | @@ -40,7 +39,7 @@ confusables.py:26:10: RUF001 String contains ambiguous `α` (GREEK SMALL LETTER 25 | # contains ASCII. 26 | x = "βα Bαd" | ^ RUF001 -27 | +27 | 28 | # The two characters should be flagged here. The first character is a "word" | @@ -50,7 +49,7 @@ confusables.py:31:6: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LET 30 | # boundary" (whitespace) that it itself ambiguous. 31 | x = "Р усский" | ^ RUF001 -32 | +32 | 33 | # Same test cases as above but using f-strings instead: | @@ -60,7 +59,7 @@ confusables.py:31:7: RUF001 String contains ambiguous ` ` (EN QUAD). Did you m 30 | # boundary" (whitespace) that it itself ambiguous. 31 | x = "Р усский" | ^ RUF001 -32 | +32 | 33 | # Same test cases as above but using f-strings instead: | @@ -88,7 +87,7 @@ confusables.py:38:7: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LET 37 | x = f"βα Bαd" 38 | x = f"Р усский" | ^ RUF001 -39 | +39 | 40 | # Nested f-strings | @@ -98,7 +97,7 @@ confusables.py:38:8: RUF001 String contains ambiguous ` ` (EN QUAD). Did you m 37 | x = f"βα Bαd" 38 | x = f"Р усский" | ^ RUF001 -39 | +39 | 40 | # Nested f-strings | @@ -107,7 +106,7 @@ confusables.py:41:7: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -116,7 +115,7 @@ confusables.py:41:21: RUF001 String contains ambiguous ` ` (EN QUAD). Did you 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -125,7 +124,7 @@ confusables.py:41:25: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LE 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -134,7 +133,7 @@ confusables.py:41:26: RUF001 String contains ambiguous ` ` (EN QUAD). Did you 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_1.snap index 64e4615f20..5fa3f25bc2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_1.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF052.py:92:9: RUF052 [*] Local dummy variable `_var` is accessed | @@ -153,7 +152,7 @@ RUF052.py:145:9: RUF052 Local dummy variable `_local` is accessed RUF052.py:153:5: RUF052 [*] Local dummy variable `_P` is accessed | 151 | from collections import namedtuple -152 | +152 | 153 | _P = ParamSpec("_P") | ^^ RUF052 154 | _T = TypeVar(name="_T", covariant=True, bound=int|str) @@ -349,7 +348,7 @@ RUF052.py:160:5: RUF052 [*] Local dummy variable `_NotADynamicClass` is accessed 159 | _DynamicClass = type("_DynamicClass", (), {}) 160 | _NotADynamicClass = type("_NotADynamicClass") | ^^^^^^^^^^^^^^^^^ RUF052 -161 | +161 | 162 | print(_T, _P, _NT, _E, _NT2, _NT3, _DynamicClass, _NotADynamicClass) | = help: Remove leading underscores diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_2.snap index c2feb4b334..bae8dcc700 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__custom_dummy_var_regexp_preset__RUF052_RUF052.py_2.snap @@ -102,7 +102,7 @@ RUF052.py:145:9: RUF052 Local dummy variable `_local` is accessed RUF052.py:153:5: RUF052 Local dummy variable `_P` is accessed | 151 | from collections import namedtuple -152 | +152 | 153 | _P = ParamSpec("_P") | ^^ RUF052 154 | _T = TypeVar(name="_T", covariant=True, bound=int|str) @@ -180,7 +180,7 @@ RUF052.py:160:5: RUF052 Local dummy variable `_NotADynamicClass` is accessed 159 | _DynamicClass = type("_DynamicClass", (), {}) 160 | _NotADynamicClass = type("_NotADynamicClass") | ^^^^^^^^^^^^^^^^^ RUF052 -161 | +161 | 162 | print(_T, _P, _NT, _E, _NT2, _NT3, _DynamicClass, _NotADynamicClass) | = help: Remove leading underscores diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF039_RUF039.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF039_RUF039.py.snap index 347cf257d1..4573c15be2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF039_RUF039.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF039_RUF039.py.snap @@ -123,7 +123,7 @@ RUF039.py:13:9: RUF039 First argument to `re.subn()` is not raw bytes literal 12 | re.sub(u'''nicode''', u"f(?i)rst") 13 | re.subn(b"""ytes are""", f"\u006e") | ^^^^^^^^^^^^^^^ RUF039 -14 | +14 | 15 | regex.compile('single free-spacing', flags=regex.X) | = help: Replace with raw bytes literal @@ -131,7 +131,7 @@ RUF039.py:13:9: RUF039 First argument to `re.subn()` is not raw bytes literal RUF039.py:15:15: RUF039 [*] First argument to `regex.compile()` is not raw string | 13 | re.subn(b"""ytes are""", f"\u006e") -14 | +14 | 15 | regex.compile('single free-spacing', flags=regex.X) | ^^^^^^^^^^^^^^^^^^^^^ RUF039 16 | regex.findall('si\ngle') @@ -250,7 +250,7 @@ RUF039.py:23:12: RUF039 First argument to `regex.subn()` is not raw bytes litera 22 | regex.sub(u'''nicode''', u"f(?i)rst") 23 | regex.subn(b"""ytes are""", f"\u006e") | ^^^^^^^^^^^^^^^ RUF039 -24 | +24 | 25 | regex.template("""(?m) | = help: Replace with raw bytes literal @@ -258,7 +258,7 @@ RUF039.py:23:12: RUF039 First argument to `regex.subn()` is not raw bytes litera RUF039.py:25:16: RUF039 [*] First argument to `regex.template()` is not raw string | 23 | regex.subn(b"""ytes are""", f"\u006e") -24 | +24 | 25 | regex.template("""(?m) | ________________^ 26 | | (?:ulti)? diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF043_RUF043.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF043_RUF043.py.snap index 82303fb160..0207b8a583 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF043_RUF043.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF043_RUF043.py.snap @@ -5,7 +5,7 @@ snapshot_kind: text RUF043.py:8:43: RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw | 6 | ### Errors - 7 | + 7 | 8 | with pytest.raises(FooAtTheEnd, match="foo."): ... | ^^^^^^ RUF043 9 | with pytest.raises(PackageExtraSpecifier, match="Install `foo[bar]` to enjoy all features"): ... @@ -28,7 +28,7 @@ RUF043.py:10:48: RUF043 Pattern passed to `match=` contains metacharacters but i 9 | with pytest.raises(PackageExtraSpecifier, match="Install `foo[bar]` to enjoy all features"): ... 10 | with pytest.raises(InnocentQuestion, match="Did you mean to use `Literal` instead?"): ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF043 -11 | +11 | 12 | with pytest.raises(StringConcatenation, match="Huh" | = help: Use a raw string or `re.escape()` to make the intention explicit @@ -36,7 +36,7 @@ RUF043.py:10:48: RUF043 Pattern passed to `match=` contains metacharacters but i RUF043.py:12:51: RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw | 10 | with pytest.raises(InnocentQuestion, match="Did you mean to use `Literal` instead?"): ... -11 | +11 | 12 | with pytest.raises(StringConcatenation, match="Huh" | ___________________________________________________^ 13 | | "?"): ... @@ -51,7 +51,7 @@ RUF043.py:14:67: RUF043 Pattern passed to `match=` contains metacharacters but i 13 | "?"): ... 14 | with pytest.raises(ManuallyEscapedWindowsPathToDotFile, match="C:\\\\Users\\\\Foo\\\\.config"): ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF043 -15 | +15 | 16 | with pytest.raises(MiddleDot, match="foo.bar"): ... | = help: Use a raw string or `re.escape()` to make the intention explicit @@ -59,7 +59,7 @@ RUF043.py:14:67: RUF043 Pattern passed to `match=` contains metacharacters but i RUF043.py:16:41: RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw | 14 | with pytest.raises(ManuallyEscapedWindowsPathToDotFile, match="C:\\\\Users\\\\Foo\\\\.config"): ... -15 | +15 | 16 | with pytest.raises(MiddleDot, match="foo.bar"): ... | ^^^^^^^^^ RUF043 17 | with pytest.raises(EndDot, match="foobar."): ... @@ -93,7 +93,7 @@ RUF043.py:19:58: RUF043 Pattern passed to `match=` contains metacharacters but i 18 | with pytest.raises(EscapedFollowedByUnescaped, match="foo\\.*bar"): ... 19 | with pytest.raises(UnescapedFollowedByEscaped, match="foo.\\*bar"): ... | ^^^^^^^^^^^^ RUF043 -20 | +20 | 21 | # https://github.com/astral-sh/ruff/issues/15316 | = help: Use a raw string or `re.escape()` to make the intention explicit @@ -109,7 +109,7 @@ RUF043.py:22:50: RUF043 Pattern passed to `match=` contains metacharacters but i RUF043.py:27:44: RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw | 25 | ## Metasequences -26 | +26 | 27 | with pytest.raises(StartOfInput, match="foo\\Abar"): ... | ^^^^^^^^^^^ RUF043 28 | with pytest.raises(WordBoundary, match="foo\\bbar"): ... @@ -209,7 +209,7 @@ RUF043.py:36:42: RUF043 Pattern passed to `match=` contains metacharacters but i 35 | with pytest.raises(NonWordCharacter, match="foo\\Wbar"): ... 36 | with pytest.raises(EndOfInput, match="foo\\zbar"): ... | ^^^^^^^^^^^ RUF043 -37 | +37 | 38 | with pytest.raises(StartOfInput2, match="foobar\\A"): ... | = help: Use a raw string or `re.escape()` to make the intention explicit @@ -217,7 +217,7 @@ RUF043.py:36:42: RUF043 Pattern passed to `match=` contains metacharacters but i RUF043.py:38:45: RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw | 36 | with pytest.raises(EndOfInput, match="foo\\zbar"): ... -37 | +37 | 38 | with pytest.raises(StartOfInput2, match="foobar\\A"): ... | ^^^^^^^^^^^ RUF043 39 | with pytest.raises(WordBoundary2, match="foobar\\b"): ... @@ -323,7 +323,7 @@ RUF043.py:47:43: RUF043 Pattern passed to `match=` contains metacharacters but i RUF043.py:52:42: RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw | 50 | ### Acceptable false positives -51 | +51 | 52 | with pytest.raises(NameEscape, match="\\N{EN DASH}"): ... | ^^^^^^^^^^^^^^ RUF043 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF046_RUF046.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF046_RUF046.py.snap index 26d34f017a..f4d9f4d465 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF046_RUF046.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF046_RUF046.py.snap @@ -4,7 +4,7 @@ source: crates/ruff_linter/src/rules/ruff/mod.rs RUF046.py:10:1: RUF046 [*] Value being cast to `int` is already an integer | 8 | ### Safely fixable - 9 | + 9 | 10 | int(id()) | ^^^^^^^^^ RUF046 11 | int(len([])) @@ -89,7 +89,7 @@ RUF046.py:14:1: RUF046 [*] Value being cast to `int` is already an integer 13 | int(hash(foo, bar)) 14 | int(int('')) | ^^^^^^^^^^^^ RUF046 -15 | +15 | 16 | int(math.comb()) | = help: Remove unnecessary `int` call @@ -107,7 +107,7 @@ RUF046.py:14:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:16:1: RUF046 [*] Value being cast to `int` is already an integer | 14 | int(int('')) -15 | +15 | 16 | int(math.comb()) | ^^^^^^^^^^^^^^^^ RUF046 17 | int(math.factorial()) @@ -213,7 +213,7 @@ RUF046.py:21:1: RUF046 [*] Value being cast to `int` is already an integer 20 | int(math.isqrt()) 21 | int(math.perm()) | ^^^^^^^^^^^^^^^^ RUF046 -22 | +22 | 23 | int(round(1, 0)) | = help: Remove unnecessary `int` call @@ -231,7 +231,7 @@ RUF046.py:21:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:23:1: RUF046 [*] Value being cast to `int` is already an integer | 21 | int(math.perm()) -22 | +22 | 23 | int(round(1, 0)) | ^^^^^^^^^^^^^^^^ RUF046 24 | int(round(1, 10)) @@ -253,7 +253,7 @@ RUF046.py:24:1: RUF046 [*] Value being cast to `int` is already an integer 23 | int(round(1, 0)) 24 | int(round(1, 10)) | ^^^^^^^^^^^^^^^^^ RUF046 -25 | +25 | 26 | int(round(1)) | = help: Remove unnecessary `int` call @@ -271,7 +271,7 @@ RUF046.py:24:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:26:1: RUF046 [*] Value being cast to `int` is already an integer | 24 | int(round(1, 10)) -25 | +25 | 26 | int(round(1)) | ^^^^^^^^^^^^^ RUF046 27 | int(round(1, None)) @@ -293,7 +293,7 @@ RUF046.py:27:1: RUF046 [*] Value being cast to `int` is already an integer 26 | int(round(1)) 27 | int(round(1, None)) | ^^^^^^^^^^^^^^^^^^^ RUF046 -28 | +28 | 29 | int(round(1.)) | = help: Remove unnecessary `int` call @@ -311,7 +311,7 @@ RUF046.py:27:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:29:1: RUF046 [*] Value being cast to `int` is already an integer | 27 | int(round(1, None)) -28 | +28 | 29 | int(round(1.)) | ^^^^^^^^^^^^^^ RUF046 30 | int(round(1., None)) @@ -333,7 +333,7 @@ RUF046.py:30:1: RUF046 [*] Value being cast to `int` is already an integer 29 | int(round(1.)) 30 | int(round(1., None)) | ^^^^^^^^^^^^^^^^^^^^ RUF046 -31 | +31 | 32 | int(1) | = help: Remove unnecessary `int` call @@ -351,7 +351,7 @@ RUF046.py:30:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:32:1: RUF046 [*] Value being cast to `int` is already an integer | 30 | int(round(1., None)) -31 | +31 | 32 | int(1) | ^^^^^^ RUF046 33 | int(v := 1) @@ -436,7 +436,7 @@ RUF046.py:36:1: RUF046 [*] Value being cast to `int` is already an integer 35 | int(-1) 36 | int(+1) | ^^^^^^^ RUF046 -37 | +37 | 38 | int(1 + 1) | = help: Remove unnecessary `int` call @@ -454,7 +454,7 @@ RUF046.py:36:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:38:1: RUF046 [*] Value being cast to `int` is already an integer | 36 | int(+1) -37 | +37 | 38 | int(1 + 1) | ^^^^^^^^^^ RUF046 39 | int(1 - 1) @@ -665,7 +665,7 @@ RUF046.py:48:1: RUF046 [*] Value being cast to `int` is already an integer 47 | int(1 & 1) 48 | int(1 // 1) | ^^^^^^^^^^^ RUF046 -49 | +49 | 50 | int(1 if ... else 2) | = help: Remove unnecessary `int` call @@ -683,10 +683,10 @@ RUF046.py:48:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:50:1: RUF046 [*] Value being cast to `int` is already an integer | 48 | int(1 // 1) -49 | +49 | 50 | int(1 if ... else 2) | ^^^^^^^^^^^^^^^^^^^^ RUF046 -51 | +51 | 52 | int(1 and 0) | = help: Remove unnecessary `int` call @@ -704,7 +704,7 @@ RUF046.py:50:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:52:1: RUF046 [*] Value being cast to `int` is already an integer | 50 | int(1 if ... else 2) -51 | +51 | 52 | int(1 and 0) | ^^^^^^^^^^^^ RUF046 53 | int(0 or -1) @@ -760,7 +760,7 @@ RUF046.py:56:4: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:62:1: RUF046 [*] Value being cast to `int` is already an integer | 60 | ### Unsafe -61 | +61 | 62 | int(math.ceil()) | ^^^^^^^^^^^^^^^^ RUF046 63 | int(math.floor()) @@ -803,7 +803,7 @@ RUF046.py:64:1: RUF046 [*] Value being cast to `int` is already an integer 63 | int(math.floor()) 64 | int(math.trunc()) | ^^^^^^^^^^^^^^^^^ RUF046 -65 | +65 | 66 | int(round(inferred_int, 0)) | = help: Remove unnecessary `int` call @@ -821,7 +821,7 @@ RUF046.py:64:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:66:1: RUF046 [*] Value being cast to `int` is already an integer | 64 | int(math.trunc()) -65 | +65 | 66 | int(round(inferred_int, 0)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF046 67 | int(round(inferred_int, 10)) @@ -843,7 +843,7 @@ RUF046.py:67:1: RUF046 [*] Value being cast to `int` is already an integer 66 | int(round(inferred_int, 0)) 67 | int(round(inferred_int, 10)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF046 -68 | +68 | 69 | int(round(inferred_int)) | = help: Remove unnecessary `int` call @@ -861,7 +861,7 @@ RUF046.py:67:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:69:1: RUF046 [*] Value being cast to `int` is already an integer | 67 | int(round(inferred_int, 10)) -68 | +68 | 69 | int(round(inferred_int)) | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF046 70 | int(round(inferred_int, None)) @@ -883,7 +883,7 @@ RUF046.py:70:1: RUF046 [*] Value being cast to `int` is already an integer 69 | int(round(inferred_int)) 70 | int(round(inferred_int, None)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF046 -71 | +71 | 72 | int(round(inferred_float)) | = help: Remove unnecessary `int` call @@ -901,7 +901,7 @@ RUF046.py:70:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:72:1: RUF046 [*] Value being cast to `int` is already an integer | 70 | int(round(inferred_int, None)) -71 | +71 | 72 | int(round(inferred_float)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF046 73 | int(round(inferred_float, None)) @@ -923,7 +923,7 @@ RUF046.py:73:1: RUF046 [*] Value being cast to `int` is already an integer 72 | int(round(inferred_float)) 73 | int(round(inferred_float, None)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF046 -74 | +74 | 75 | int(round(unknown)) | = help: Remove unnecessary `int` call @@ -941,7 +941,7 @@ RUF046.py:73:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:75:1: RUF046 [*] Value being cast to `int` is already an integer | 73 | int(round(inferred_float, None)) -74 | +74 | 75 | int(round(unknown)) | ^^^^^^^^^^^^^^^^^^^ RUF046 76 | int(round(unknown, None)) @@ -979,11 +979,11 @@ RUF046.py:76:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:158:1: RUF046 [*] Value being cast to `int` is already an integer | 156 | int(1. if ... else .2) -157 | +157 | 158 | / int(1 + 159 | | 1) | |______^ RUF046 -160 | +160 | 161 | int(round(1, | = help: Remove unnecessary `int` call @@ -1001,11 +1001,11 @@ RUF046.py:158:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:161:1: RUF046 [*] Value being cast to `int` is already an integer | 159 | 1) -160 | +160 | 161 | / int(round(1, 162 | | 0)) | |_____________^ RUF046 -163 | +163 | 164 | # function calls may need to retain parentheses | = help: Remove unnecessary `int` call @@ -1029,7 +1029,7 @@ RUF046.py:168:1: RUF046 [*] Value being cast to `int` is already an integer 168 | / int(round 169 | | (1)) | |____^ RUF046 -170 | +170 | 171 | int(round # a comment | = help: Remove unnecessary `int` call @@ -1047,13 +1047,13 @@ RUF046.py:168:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:171:1: RUF046 [*] Value being cast to `int` is already an integer | 169 | (1)) -170 | +170 | 171 | / int(round # a comment 172 | | # and another comment 173 | | (10) 174 | | ) | |_^ RUF046 -175 | +175 | 176 | int(round (17)) # this is safe without parens | = help: Remove unnecessary `int` call @@ -1075,10 +1075,10 @@ RUF046.py:171:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:176:1: RUF046 [*] Value being cast to `int` is already an integer | 174 | ) -175 | +175 | 176 | int(round (17)) # this is safe without parens | ^^^^^^^^^^^^^^^ RUF046 -177 | +177 | 178 | int( round ( | = help: Remove unnecessary `int` call @@ -1096,12 +1096,12 @@ RUF046.py:176:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:178:1: RUF046 [*] Value being cast to `int` is already an integer | 176 | int(round (17)) # this is safe without parens -177 | +177 | 178 | / int( round ( 179 | | 17 180 | | )) # this is also safe without parens | |______________^ RUF046 -181 | +181 | 182 | int((round) # Comment | = help: Remove unnecessary `int` call @@ -1122,12 +1122,12 @@ RUF046.py:178:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:182:1: RUF046 [*] Value being cast to `int` is already an integer | 180 | )) # this is also safe without parens -181 | +181 | 182 | / int((round) # Comment 183 | | (42) 184 | | ) | |_^ RUF046 -185 | +185 | 186 | int((round # Comment | = help: Remove unnecessary `int` call @@ -1148,12 +1148,12 @@ RUF046.py:182:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:186:1: RUF046 [*] Value being cast to `int` is already an integer | 184 | ) -185 | +185 | 186 | / int((round # Comment 187 | | )(42) 188 | | ) | |_^ RUF046 -189 | +189 | 190 | int( # Unsafe fix because of this comment | = help: Remove unnecessary `int` call @@ -1173,7 +1173,7 @@ RUF046.py:186:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:190:1: RUF046 [*] Value being cast to `int` is already an integer | 188 | ) -189 | +189 | 190 | / int( # Unsafe fix because of this comment 191 | | ( # Comment 192 | | (round @@ -1181,7 +1181,7 @@ RUF046.py:190:1: RUF046 [*] Value being cast to `int` is already an integer 194 | | )(42) 195 | | ) | |_^ RUF046 -196 | +196 | 197 | int( | = help: Remove unnecessary `int` call @@ -1203,14 +1203,14 @@ RUF046.py:190:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:197:1: RUF046 [*] Value being cast to `int` is already an integer | 195 | ) -196 | +196 | 197 | / int( 198 | | round( 199 | | 42 200 | | ) # unsafe fix because of this comment 201 | | ) | |_^ RUF046 -202 | +202 | 203 | int( | = help: Remove unnecessary `int` call @@ -1233,7 +1233,7 @@ RUF046.py:197:1: RUF046 [*] Value being cast to `int` is already an integer RUF046.py:203:1: RUF046 [*] Value being cast to `int` is already an integer | 201 | ) -202 | +202 | 203 | / int( 204 | | round( 205 | | 42 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048.py.snap index fe1dcd4691..94348d4363 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048.py.snap @@ -13,7 +13,7 @@ RUF048.py:5:6: RUF048 `__version__` may contain non-integral-like elements 4 | tuple(map(int, __version__.split("."))) 5 | list(map(int, __version__.split("."))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF048 -6 | +6 | 7 | # `sep` passed as keyword argument | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048_1.py.snap index a78add9e5d..ae6ce29c4e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF048_RUF048_1.py.snap @@ -33,7 +33,7 @@ RUF048_1.py:8:6: RUF048 `__version__` may contain non-integral-like elements 7 | tuple(map(int, bar.__version__.split("."))) 8 | list(map(int, bar.__version__.split("."))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF048 - 9 | + 9 | 10 | # `sep` passed as keyword argument | @@ -48,7 +48,7 @@ RUF048_1.py:11:13: RUF048 `__version__` may contain non-integral-like elements RUF048_1.py:14:13: RUF048 `__version__` may contain non-integral-like elements | 12 | print(part) -13 | +13 | 14 | for part in map(int, __version__.split(sep=".")): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF048 15 | print(part) diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF049_RUF049.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF049_RUF049.py.snap index 6641c9bc2b..a2189975df 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF049_RUF049.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF049_RUF049.py.snap @@ -1,11 +1,10 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF049.py:10:1: RUF049 An enum class should not be decorated with `@dataclass` | 8 | ## Errors - 9 | + 9 | 10 | @dataclass | ^^^^^^^^^^ RUF049 11 | class E(Enum): ... diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_0.py.snap index 21fe4c34f8..fc63097a61 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_0.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF055_0.py:6:1: RUF055 [*] Plain string pattern passed to `re` function | @@ -86,7 +85,7 @@ RUF055_0.py:39:1: RUF055 [*] Plain string pattern passed to `re` function 38 | # this should be replaced with s.split("abc") 39 | re.split("abc", s) | ^^^^^^^^^^^^^^^^^^ RUF055 -40 | +40 | 41 | # these currently should not be modified because the patterns contain regex | = help: Replace with `s.split("abc")` @@ -112,7 +111,7 @@ RUF055_0.py:71:1: RUF055 [*] Plain string pattern passed to `re` function 76 | | s, # string 77 | | ) | |_^ RUF055 -78 | +78 | 79 | # A diagnostic should not be emitted for `sub` replacements with backreferences or | = help: Replace with `s.replace("abc", "")` @@ -190,14 +189,14 @@ RUF055_0.py:92:1: RUF055 Plain string pattern passed to `re` function 91 | re.sub(r"a", "\a", "a") 92 | re.sub(r"a", r"\a", "a") | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF055 -93 | +93 | 94 | re.sub(r"a", "\?", "a") | RUF055_0.py:94:1: RUF055 [*] Plain string pattern passed to `re` function | 92 | re.sub(r"a", r"\a", "a") -93 | +93 | 94 | re.sub(r"a", "\?", "a") | ^^^^^^^^^^^^^^^^^^^^^^^ RUF055 95 | re.sub(r"a", r"\?", "a") diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_1.py.snap index c9c05238b7..ce46702918 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview__RUF055_RUF055_1.py.snap @@ -4,10 +4,10 @@ source: crates/ruff_linter/src/rules/ruff/mod.rs RUF055_1.py:9:1: RUF055 [*] Plain string pattern passed to `re` function | 7 | pat1 = "needle" - 8 | + 8 | 9 | re.sub(pat1, "", haystack) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF055 -10 | +10 | 11 | # aliases are not followed, so this one should not trigger the rule | = help: Replace with `haystack.replace(pat1, "")` diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap index d6f6e62a28..582ef1bac4 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__preview_confusables.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- confusables.py:1:6: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD CAPITAL B). Did you mean `B` (LATIN CAPITAL LETTER B)? | @@ -40,7 +39,7 @@ confusables.py:26:10: RUF001 String contains ambiguous `α` (GREEK SMALL LETTER 25 | # contains ASCII. 26 | x = "βα Bαd" | ^ RUF001 -27 | +27 | 28 | # The two characters should be flagged here. The first character is a "word" | @@ -50,7 +49,7 @@ confusables.py:31:6: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LET 30 | # boundary" (whitespace) that it itself ambiguous. 31 | x = "Р усский" | ^ RUF001 -32 | +32 | 33 | # Same test cases as above but using f-strings instead: | @@ -60,7 +59,7 @@ confusables.py:31:7: RUF001 String contains ambiguous ` ` (EN QUAD). Did you m 30 | # boundary" (whitespace) that it itself ambiguous. 31 | x = "Р усский" | ^ RUF001 -32 | +32 | 33 | # Same test cases as above but using f-strings instead: | @@ -88,7 +87,7 @@ confusables.py:38:7: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LET 37 | x = f"βα Bαd" 38 | x = f"Р усский" | ^ RUF001 -39 | +39 | 40 | # Nested f-strings | @@ -98,7 +97,7 @@ confusables.py:38:8: RUF001 String contains ambiguous ` ` (EN QUAD). Did you m 37 | x = f"βα Bαd" 38 | x = f"Р усский" | ^ RUF001 -39 | +39 | 40 | # Nested f-strings | @@ -107,7 +106,7 @@ confusables.py:41:7: RUF001 String contains ambiguous `𝐁` (MATHEMATICAL BOLD 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -116,7 +115,7 @@ confusables.py:41:21: RUF001 String contains ambiguous ` ` (EN QUAD). Did you 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -125,7 +124,7 @@ confusables.py:41:25: RUF001 String contains ambiguous `Р` (CYRILLIC CAPITAL LE 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -134,7 +133,7 @@ confusables.py:41:26: RUF001 String contains ambiguous ` ` (EN QUAD). Did you 40 | # Nested f-strings 41 | x = f"𝐁ad string {f" {f"Р усский"}"}" | ^ RUF001 -42 | +42 | 43 | # Comments inside f-strings | @@ -160,7 +159,7 @@ confusables.py:55:28: RUF001 String contains ambiguous `µ` (MICRO SIGN). Did yo | 55 | assert getattr(Labware(), "µL") == 1.5 | ^ RUF001 -56 | +56 | 57 | # Implicit string concatenation | 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 5501c10475..b4fc07e49e 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | @@ -26,7 +25,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 12 | # Invalid 13 | d = 1 # noqa: E501 | ^^^^^^^^^^^^ RUF100 -14 | +14 | 15 | # Invalid | = help: Remove unused `noqa` directive @@ -46,7 +45,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 15 | # Invalid 16 | d = 1 # noqa: F841, E501 | ^^^^^^^^^^^^^^^^^^ RUF100 -17 | +17 | 18 | # Invalid (and unimplemented or not enabled) | = help: Remove unused `noqa` directive @@ -66,7 +65,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 18 | # Invalid (and unimplemented or not enabled) 19 | d = 1 # noqa: F841, W191, F821 | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -20 | +20 | 21 | # Invalid (but external) | = help: Remove unused `noqa` directive @@ -86,7 +85,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 21 | # Invalid (but external) 22 | d = 1 # noqa: F841, V101 | ^^^^^^^^^^^^^^^^^^ RUF100 -23 | +23 | 24 | # Invalid (but external) | = help: Remove unused `noqa` directive @@ -106,7 +105,7 @@ RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) 24 | # Invalid (but external) 25 | d = 1 # noqa: V500 | ^^^^^^^^^^^^ RUF100 -26 | +26 | 27 | # fmt: off | = help: Remove unused `noqa` directive @@ -127,7 +126,7 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 28 | # Invalid - no space before # 29 | d = 1 # noqa: E501 | ^^^^^^^^^^^^ RUF100 -30 | +30 | 31 | # Invalid - many spaces before # | = help: Remove unused `noqa` directive @@ -184,7 +183,7 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 58 | """ # noqa: E501, F841 | ^^^^^^^^^^^^^^^^^^ RUF100 -59 | +59 | 60 | # Invalid | = help: Remove unused `noqa` directive @@ -204,7 +203,7 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 66 | """ # noqa: E501 | ^^^^^^^^^^^^ RUF100 -67 | +67 | 68 | # Invalid | = help: Remove unused `noqa` directive @@ -224,7 +223,7 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 74 | """ # noqa | ^^^^^^ RUF100 -75 | +75 | 76 | # Valid | = help: Remove unused `noqa` directive @@ -261,7 +260,7 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused RUF100_0.py:93:89: E501 Line too long (89 > 88) | 91 | print(sys.path) -92 | +92 | 93 | "shape: (6,)\nSeries: '' [duration[μs]]\n[\n\t0µs\n\t1µs\n\t2µs\n\t3µs\n\t4µs\n\t5µs\n]" # noqa: F401 | ^ E501 | @@ -269,7 +268,7 @@ RUF100_0.py:93:89: E501 Line too long (89 > 88) RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 91 | print(sys.path) -92 | +92 | 93 | "shape: (6,)\nSeries: '' [duration[μs]]\n[\n\t0µs\n\t1µs\n\t2µs\n\t3µs\n\t4µs\n\t5µs\n]" # noqa: F401 | ^^^^^^^^^^^^ RUF100 | @@ -348,7 +347,7 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn 117 | def f(): 118 | x = 2 # noqa: F841, F841, X200 | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -119 | +119 | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 | = help: Remove unused `noqa` directive @@ -366,10 +365,10 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) | 118 | x = 2 # noqa: F841, F841, X200 -119 | +119 | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -121 | +121 | 122 | z = 2 # noqa: F841 F841 F841, F841, F841 | = help: Remove unused `noqa` directive @@ -387,10 +386,10 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 -121 | +121 | 122 | z = 2 # noqa: F841 F841 F841, F841, F841 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -123 | +123 | 124 | return | = help: Remove unused `noqa` directive 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 631a2d7a0e..68c0809458 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | @@ -26,7 +25,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 12 | # Invalid 13 | d = 1 # noqa: E501 | ^^^^^^^^^^^^ RUF100 -14 | +14 | 15 | # Invalid | = help: Remove unused `noqa` directive @@ -46,7 +45,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 15 | # Invalid 16 | d = 1 # noqa: F841, E501 | ^^^^^^^^^^^^^^^^^^ RUF100 -17 | +17 | 18 | # Invalid (and unimplemented or not enabled) | = help: Remove unused `noqa` directive @@ -66,7 +65,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 18 | # Invalid (and unimplemented or not enabled) 19 | d = 1 # noqa: F841, W191, F821 | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -20 | +20 | 21 | # Invalid (but external) | = help: Remove unused `noqa` directive @@ -86,7 +85,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 21 | # Invalid (but external) 22 | d = 1 # noqa: F841, V101 | ^^^^^^^^^^^^^^^^^^ RUF100 -23 | +23 | 24 | # Invalid (but external) | = help: Remove unused `noqa` directive @@ -107,7 +106,7 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 28 | # Invalid - no space before # 29 | d = 1 # noqa: E501 | ^^^^^^^^^^^^ RUF100 -30 | +30 | 31 | # Invalid - many spaces before # | = help: Remove unused `noqa` directive @@ -164,7 +163,7 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 58 | """ # noqa: E501, F841 | ^^^^^^^^^^^^^^^^^^ RUF100 -59 | +59 | 60 | # Invalid | = help: Remove unused `noqa` directive @@ -184,7 +183,7 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 66 | """ # noqa: E501 | ^^^^^^^^^^^^ RUF100 -67 | +67 | 68 | # Invalid | = help: Remove unused `noqa` directive @@ -204,7 +203,7 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 74 | """ # noqa | ^^^^^^ RUF100 -75 | +75 | 76 | # Valid | = help: Remove unused `noqa` directive @@ -241,7 +240,7 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused RUF100_0.py:93:89: E501 Line too long (89 > 88) | 91 | print(sys.path) -92 | +92 | 93 | "shape: (6,)\nSeries: '' [duration[μs]]\n[\n\t0µs\n\t1µs\n\t2µs\n\t3µs\n\t4µs\n\t5µs\n]" # noqa: F401 | ^ E501 | @@ -249,7 +248,7 @@ RUF100_0.py:93:89: E501 Line too long (89 > 88) RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 91 | print(sys.path) -92 | +92 | 93 | "shape: (6,)\nSeries: '' [duration[μs]]\n[\n\t0µs\n\t1µs\n\t2µs\n\t3µs\n\t4µs\n\t5µs\n]" # noqa: F401 | ^^^^^^^^^^^^ RUF100 | @@ -328,7 +327,7 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn 117 | def f(): 118 | x = 2 # noqa: F841, F841, X200 | ^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -119 | +119 | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 | = help: Remove unused `noqa` directive @@ -346,10 +345,10 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) | 118 | x = 2 # noqa: F841, F841, X200 -119 | +119 | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -121 | +121 | 122 | z = 2 # noqa: F841 F841 F841, F841, F841 | = help: Remove unused `noqa` directive @@ -367,10 +366,10 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 -121 | +121 | 122 | z = 2 # noqa: F841 F841 F841, F841, F841 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF100 -123 | +123 | 124 | return | = help: Remove unused `noqa` directive 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 65d1f67dbd..f0918df155 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive | @@ -142,7 +141,7 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 12 | print(a) # noqa comment -13 | +13 | 14 | # noqa: E501, F821 | ^^^^^^^^^^^^^^^^^^ RUF100 15 | # noqa: E501, F821 # comment @@ -436,7 +435,7 @@ RUF100_3.py:28:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 27 | print(a) # noqa: E501, ,F821 comment 28 | print(a) # noqa: E501 F821 comment | ^^^^^^^^^^^^^^^^^ RUF100 -29 | +29 | 30 | print(a) # comment with unicode µ # noqa: E501 | = help: Remove unused `noqa` directive @@ -454,7 +453,7 @@ RUF100_3.py:28:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) RUF100_3.py:30:7: F821 Undefined name `a` | 28 | print(a) # noqa: E501 F821 comment -29 | +29 | 30 | print(a) # comment with unicode µ # noqa: E501 | ^ F821 31 | print(a) # comment with unicode µ # noqa: E501, F821 @@ -463,7 +462,7 @@ RUF100_3.py:30:7: F821 Undefined name `a` RUF100_3.py:30:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 28 | print(a) # noqa: E501 F821 comment -29 | +29 | 30 | print(a) # comment with unicode µ # noqa: E501 | ^^^^^^^^^^^^ RUF100 31 | print(a) # comment with unicode µ # noqa: E501, F821 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 8077bfa4ed..05d515713a 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 @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs -snapshot_kind: text --- RUF100_5.py:7:5: ERA001 Found commented-out code | @@ -25,7 +24,7 @@ RUF100_5.py:11:1: ERA001 Found commented-out code | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^^^^^^^^^^^^^ ERA001 -12 | +12 | 13 | def f(): | = help: Remove commented-out code @@ -43,7 +42,7 @@ RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^ RUF100 -12 | +12 | 13 | def f(): | = help: Remove unused `noqa` directive @@ -64,7 +63,7 @@ RUF100_5.py:16:18: RUF100 [*] Unused `noqa` directive (non-enabled: `RET504`) 15 | # line below should autofix to `return data # fmt: skip` 16 | return data # noqa: RET504 # fmt: skip | ^^^^^^^^^^^^^^ RUF100 -17 | +17 | 18 | def f(): | = help: Remove unused `noqa` directive diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap index 03d81d83a8..9e60594d46 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs -snapshot_kind: text --- TRY400.py:13:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | @@ -8,7 +7,7 @@ TRY400.py:13:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 12 | except Exception: 13 | logging.error("Context message here") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY400 -14 | +14 | 15 | if True: | = help: Replace with `exception` @@ -47,7 +46,7 @@ TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 26 | except Exception: 27 | logger.error("Context message here") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY400 -28 | +28 | 29 | if True: | = help: Replace with `exception` @@ -86,7 +85,7 @@ TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 36 | except Exception: 37 | log.error("Context message here") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY400 -38 | +38 | 39 | if True: | = help: Replace with `exception` @@ -125,7 +124,7 @@ TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 46 | except Exception: 47 | self.logger.error("Context message here") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY400 -48 | +48 | 49 | if True: | = help: Replace with `exception` @@ -164,7 +163,7 @@ TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 99 | except Exception: 100 | error("Context message here") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY400 -101 | +101 | 102 | if True: | = help: Replace with `exception` diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap index 8bba4a062d..0df2113706 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-vanilla-class_TRY002.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs -snapshot_kind: text --- TRY002.py:13:15: TRY002 Create your own exception | @@ -8,7 +7,7 @@ TRY002.py:13:15: TRY002 Create your own exception 12 | if a == 1: 13 | raise Exception("Custom message") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY002 -14 | +14 | 15 | b = 1 | @@ -26,7 +25,7 @@ TRY002.py:37:15: TRY002 Create your own exception 36 | if a == 1: 37 | raise BaseException("Custom message") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY002 -38 | +38 | 39 | b = 1 | diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap index 3030a80d2b..707345cf44 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__raise-within-try_TRY301.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs -snapshot_kind: text --- TRY301.py:14:13: TRY301 Abstract `raise` to an inner function | @@ -8,17 +7,17 @@ TRY301.py:14:13: TRY301 Abstract `raise` to an inner function 13 | if not a: 14 | raise MyException(a) | ^^^^^^^^^^^^^^^^^^^^ TRY301 -15 | +15 | 16 | raise MyException(a) | TRY301.py:16:9: TRY301 Abstract `raise` to an inner function | 14 | raise MyException(a) -15 | +15 | 16 | raise MyException(a) | ^^^^^^^^^^^^^^^^^^^^ TRY301 -17 | +17 | 18 | try: | @@ -38,17 +37,17 @@ TRY301.py:32:13: TRY301 Abstract `raise` to an inner function 31 | if not a: 32 | raise MyException(a) | ^^^^^^^^^^^^^^^^^^^^ TRY301 -33 | +33 | 34 | raise MyException(a) | TRY301.py:34:9: TRY301 Abstract `raise` to an inner function | 32 | raise MyException(a) -33 | +33 | 34 | raise MyException(a) | ^^^^^^^^^^^^^^^^^^^^ TRY301 -35 | +35 | 36 | try: | diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap index 6999f6b92a..ddb8fc15bb 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-log-message_TRY401.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs -snapshot_kind: text --- TRY401.py:8:45: TRY401 Redundant exception object included in `logging.exception` call | @@ -55,7 +54,7 @@ TRY401.py:24:45: TRY401 Redundant exception object included in `logging.exceptio 23 | logger.exception(f"Found an error: {bad}") # TRY401 24 | logger.exception(f"Found an error: {bad}") # TRY401 | ^^^ TRY401 -25 | +25 | 26 | if True: | @@ -143,7 +142,7 @@ TRY401.py:93:38: TRY401 Redundant exception object included in `logging.exceptio 92 | exception(f"Found an error: {bad}") # TRY401 93 | exception(f"Found an error: {bad}") # TRY401 | ^^^ TRY401 -94 | +94 | 95 | if True: | 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 9899e6297d..1bf54524d9 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 @@ -1,14 +1,13 @@ --- source: crates/ruff_linter/src/linter.rs -snapshot_kind: text --- ipy_escape_command.ipynb:cell 1:5:8: F401 [*] `os` imported but unused | 3 | %matplotlib inline -4 | +4 | 5 | import os | ^^ F401 -6 | +6 | 7 | _ = math.pi | = help: Remove unused import: `os` diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap index 2f0aa2ab11..a8c65c981a 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__vscode_language_id.snap @@ -1,12 +1,11 @@ --- source: crates/ruff_linter/src/linter.rs -snapshot_kind: text --- vscode_language_id.ipynb:cell 3:1:8: F401 [*] `os` imported but unused | 1 | import os | ^^ F401 -2 | +2 | 3 | print("hello world") | = help: Remove unused import: `os` diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap index 346c5353a0..4ef425440b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/double_starred.py -snapshot_kind: text --- ## AST @@ -201,14 +200,14 @@ Module( 2 | call(** *x) 3 | call(***x) | ^^ Syntax Error: Starred expression cannot be used here -4 | +4 | 5 | call(**x := 1) | | 3 | call(***x) -4 | +4 | 5 | call(**x := 1) | ^^ Syntax Error: Expected ',', found ':=' | @@ -216,7 +215,7 @@ Module( | 3 | call(***x) -4 | +4 | 5 | call(**x := 1) | ^ Syntax Error: Positional argument cannot follow keyword argument unpacking | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap index 70177d5520..46cb028b2a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/invalid_expression.py -snapshot_kind: text --- ## AST @@ -179,14 +178,14 @@ Module( 1 | call(x + y = 1) 2 | call(x := 1 = 1) | ^^^^^^ Syntax Error: Expected a parameter name -3 | +3 | 4 | call(yield x) | | 2 | call(x := 1 = 1) -3 | +3 | 4 | call(yield x) | ^^^^^^^ Syntax Error: Yield expression cannot be used here 5 | call(yield from x) diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap index ed8132fa6e..1c86ec46e3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/missing_expression.py -snapshot_kind: text --- ## AST @@ -162,6 +161,6 @@ Module( 2 | call(x = ) 3 | call(*, y) | ^ Syntax Error: Expected an expression -4 | +4 | 5 | foo | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap index fa0a24674c..0ea8939500 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/unclosed_0.py -snapshot_kind: text --- ## AST @@ -69,7 +68,7 @@ Module( | 1 | call( | ^ Syntax Error: Expected ')', found newline -2 | +2 | 3 | def foo(): 4 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap index 1388d6761f..af8a140c61 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/unclosed_1.py -snapshot_kind: text --- ## AST @@ -77,7 +76,7 @@ Module( | 1 | call(x | ^ Syntax Error: Expected ')', found newline -2 | +2 | 3 | def foo(): 4 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap index df28c5c6da..d41c5727a7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/unclosed_2.py -snapshot_kind: text --- ## AST @@ -77,7 +76,7 @@ Module( | 1 | call(x, | ^ Syntax Error: Expected ')', found newline -2 | +2 | 3 | def foo(): 4 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap index 2c07927222..747e1c7a79 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/await/no_expression_0.py -snapshot_kind: text --- ## AST @@ -62,6 +61,6 @@ Module( 1 | # No expression after `await`, an expression on another line 2 | await | ^ Syntax Error: Expected an expression -3 | +3 | 4 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap index 140d14011a..7d67f0e700 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/await/no_expression_1.py -snapshot_kind: text --- ## AST @@ -65,7 +64,7 @@ Module( 1 | # No expression after `await`, a statement on another line 2 | await | ^ Syntax Error: Expected an expression -3 | +3 | 4 | def foo(): 5 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap index de33b13673..87c433552a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/await/recover.py -snapshot_kind: text --- ## AST @@ -249,7 +248,7 @@ Module( 4 | # Nested await 5 | await await x | ^^^^^^^ Syntax Error: Await expression cannot be used here -6 | +6 | 7 | # Starred expressions | @@ -267,7 +266,7 @@ Module( 8 | await *x 9 | await (*x) | ^^ Syntax Error: Starred expression cannot be used here -10 | +10 | 11 | # Invalid expression as per precedence | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap index e961c326aa..cb65ebee14 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/invalid_rhs_expression.py -snapshot_kind: text --- ## AST @@ -104,14 +103,14 @@ Module( | 1 | x + lambda y: y | ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here -2 | +2 | 3 | x - yield y | | 1 | x + lambda y: y -2 | +2 | 3 | x - yield y | ^^^^^^^ Syntax Error: Yield expression cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap index cce646dc94..7e9d24594d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/missing_lhs.py -snapshot_kind: text --- ## AST @@ -58,6 +57,6 @@ Module( | 1 | / y | ^ Syntax Error: Expected a statement -2 | +2 | 3 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap index 59b52ca24a..9f84e4249e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/missing_rhs_0.py -snapshot_kind: text --- ## AST @@ -72,6 +71,6 @@ Module( | 1 | 0 + | ^ Syntax Error: Expected an expression -2 | +2 | 3 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap index b6392a1552..2951642fe3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/missing_rhs_1.py -snapshot_kind: text --- ## AST @@ -100,6 +99,6 @@ Module( | 1 | 1 + 2 - 3 * | ^ Syntax Error: Expected an expression -2 | +2 | 3 | 4 + 5 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap index 6690771f30..9b4a04616c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/bool_op/invalid_rhs_expression.py -snapshot_kind: text --- ## AST @@ -108,14 +107,14 @@ Module( | 1 | x and lambda y: y | ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here -2 | +2 | 3 | x or yield y | | 1 | x and lambda y: y -2 | +2 | 3 | x or yield y | ^^^^^^^ Syntax Error: Yield expression cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap index 16ed53c32d..34a82c7f26 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/bool_op/missing_rhs.py -snapshot_kind: text --- ## AST @@ -73,6 +72,6 @@ Module( | 1 | x and | ^ Syntax Error: Expected an expression -2 | +2 | 3 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap index bb9cf68340..efd6a63b4d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/invalid_order.py -snapshot_kind: text --- ## AST @@ -134,7 +133,7 @@ Module( | 1 | x in not y | ^^^^^ Syntax Error: Boolean 'not' expression cannot be used here -2 | +2 | 3 | # `=>` instead of `>=` | @@ -143,7 +142,7 @@ Module( 3 | # `=>` instead of `>=` 4 | x => y | ^ Syntax Error: Expected an expression -5 | +5 | 6 | # Same here as well, `not` without `in` is considered to be a unary operator | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap index 90b9b4d764..7fac7231c7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/invalid_rhs_expression.py -snapshot_kind: text --- ## AST @@ -112,14 +111,14 @@ Module( | 1 | x not in lambda y: y | ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here -2 | +2 | 3 | x == yield y | | 1 | x not in lambda y: y -2 | +2 | 3 | x == yield y | ^^^^^^^ Syntax Error: Yield expression cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap index 8eb0e29ee0..755eb042a5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_lhs.py -snapshot_kind: text --- ## AST @@ -58,6 +57,6 @@ Module( | 1 | > y | ^ Syntax Error: Expected a statement -2 | +2 | 3 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap index ddee94eb32..135f76de35 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_rhs_0.py -snapshot_kind: text --- ## AST @@ -75,6 +74,6 @@ Module( | 1 | x > | ^ Syntax Error: Expected an expression -2 | +2 | 3 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap index fe3c56661c..f61bcb3b89 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_rhs_1.py -snapshot_kind: text --- ## AST @@ -77,7 +76,7 @@ Module( 1 | # Without the `in`, this is considered to be a unary `not` 2 | x not | ^^^ Syntax Error: Simple statements must be separated by newlines or semicolons -3 | +3 | 4 | 1 + 2 | @@ -86,6 +85,6 @@ Module( 1 | # Without the `in`, this is considered to be a unary `not` 2 | x not | ^ Syntax Error: Expected an expression -3 | +3 | 4 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap index 267e8dfd39..e530d30468 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_rhs_2.py -snapshot_kind: text --- ## AST @@ -75,6 +74,6 @@ Module( | 1 | x is not | ^ Syntax Error: Expected an expression -2 | +2 | 3 | 1 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap index ac715fc3eb..61e69b69f9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/starred_expression.py -snapshot_kind: text --- ## AST @@ -167,14 +166,14 @@ Module( 1 | x >= *y 2 | x not in *y | ^^ Syntax Error: Starred expression cannot be used here -3 | +3 | 4 | *x < y | | 2 | x not in *y -3 | +3 | 4 | *x < y | ^^^^^ Syntax Error: Comparison expression cannot be used here 5 | *x is not y diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap index 5316288d28..6d06ef0c12 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/comprehension.py -snapshot_kind: text --- ## AST @@ -749,7 +748,7 @@ Module( 4 | {x: y for call() in y} 5 | {x: y for {a, b} in y} | ^^^^^^ Syntax Error: Invalid assignment target -6 | +6 | 7 | # Invalid iter | @@ -787,7 +786,7 @@ Module( 10 | {x: y for x in yield from y} 11 | {x: y for x in lambda y: y} | ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here -12 | +12 | 13 | # Invalid if | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap index 51c5017b80..18f34772fa 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/double_star.py -snapshot_kind: text --- ## AST @@ -482,7 +481,7 @@ Module( | 2 | # the ones which are higher than that. -3 | +3 | 4 | {**x := 1} | ^^ Syntax Error: Expected ',', found ':=' 5 | {a: 1, **x if True else y} @@ -492,7 +491,7 @@ Module( | 2 | # the ones which are higher than that. -3 | +3 | 4 | {**x := 1} | ^ Syntax Error: Expected ':', found '}' 5 | {a: 1, **x if True else y} diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap index a64d76004a..2cdfca3714 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/double_star_comprehension.py -snapshot_kind: text --- ## AST @@ -111,49 +110,49 @@ Module( | 2 | # it's actually a comprehension. -3 | +3 | 4 | {**x: y for x, y in data} | ^ Syntax Error: Expected an expression or a '}' -5 | +5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | | 2 | # it's actually a comprehension. -3 | +3 | 4 | {**x: y for x, y in data} | ^^^ Syntax Error: Expected ':', found 'for' -5 | +5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | | 2 | # it's actually a comprehension. -3 | +3 | 4 | {**x: y for x, y in data} | ^ Syntax Error: Expected ',', found name -5 | +5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | | 2 | # it's actually a comprehension. -3 | +3 | 4 | {**x: y for x, y in data} | ^ Syntax Error: Expected ':', found ',' -5 | +5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | | 2 | # it's actually a comprehension. -3 | +3 | 4 | {**x: y for x, y in data} | ^ Syntax Error: Expected ':', found '}' -5 | +5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap index 52219b3d37..99ceea07ed 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/missing_closing_brace_2.py -snapshot_kind: text --- ## AST @@ -78,7 +77,7 @@ Module( | 1 | {x: 1, | ^ Syntax Error: Expected '}', found newline -2 | +2 | 3 | def foo(): 4 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap index 37dbfd7312..b3123ce9b0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/named_expression_0.py -snapshot_kind: text --- ## AST @@ -123,19 +122,19 @@ Module( | 1 | # Unparenthesized named expression not allowed in key -2 | +2 | 3 | {x := 1: y, z := 2: a} | ^^^^^^ Syntax Error: Unparenthesized named expression cannot be used here -4 | +4 | 5 | x + y | | 1 | # Unparenthesized named expression not allowed in key -2 | +2 | 3 | {x := 1: y, z := 2: a} | ^^ Syntax Error: Expected ':', found ':=' -4 | +4 | 5 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap index 8bdfa594b8..dd7855f8b4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/named_expression_1.py -snapshot_kind: text --- ## AST @@ -129,39 +128,39 @@ Module( | 1 | # Unparenthesized named expression not allowed in value -2 | +2 | 3 | {x: y := 1, z: a := 2} | ^^ Syntax Error: Expected ',', found ':=' -4 | +4 | 5 | x + y | | 1 | # Unparenthesized named expression not allowed in value -2 | +2 | 3 | {x: y := 1, z: a := 2} | ^ Syntax Error: Expected ':', found ',' -4 | +4 | 5 | x + y | | 1 | # Unparenthesized named expression not allowed in value -2 | +2 | 3 | {x: y := 1, z: a := 2} | ^^ Syntax Error: Expected ',', found ':=' -4 | +4 | 5 | x + y | | 1 | # Unparenthesized named expression not allowed in value -2 | +2 | 3 | {x: y := 1, z: a := 2} | ^ Syntax Error: Expected ':', found '}' -4 | +4 | 5 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap index 33a294396e..71d0198372 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/recover.py -snapshot_kind: text --- ## AST @@ -422,30 +421,30 @@ Module( | 1 | # Test cases for dictionary expressions where the parser recovers from a syntax error. -2 | +2 | 3 | {,} | ^ Syntax Error: Expected an expression -4 | +4 | 5 | {1: 2,,3: 4} | | 3 | {,} -4 | +4 | 5 | {1: 2,,3: 4} | ^ Syntax Error: Expected an expression or a '}' -6 | +6 | 7 | {1: 2,,} | | 5 | {1: 2,,3: 4} -6 | +6 | 7 | {1: 2,,} | ^ Syntax Error: Expected an expression or a '}' -8 | +8 | 9 | # Missing comma | @@ -454,7 +453,7 @@ Module( 9 | # Missing comma 10 | {1: 2 3: 4} | ^ Syntax Error: Expected ',', found int -11 | +11 | 12 | # No value | @@ -463,7 +462,7 @@ Module( 12 | # No value 13 | {1: } | ^ Syntax Error: Expected an expression -14 | +14 | 15 | # No value for double star unpacking | @@ -481,7 +480,7 @@ Module( 16 | {**} 17 | {x: y, **, a: b} | ^ Syntax Error: Expected an expression -18 | +18 | 19 | # This is not a double star unpacking | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap index 70cedec830..7a4f5b3f5d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/emoji_identifiers.py -snapshot_kind: text --- ## AST @@ -89,7 +88,7 @@ Module( 2 | # comment 🐶 3 | ) | ^ Syntax Error: Expected a statement -4 | +4 | 5 | a = (🐶 + | @@ -99,7 +98,7 @@ Module( 2 | # comment 🐶 3 | ) | ^ Syntax Error: Expected a statement -4 | +4 | 5 | a = (🐶 + 6 | # comment | @@ -107,7 +106,7 @@ Module( | 3 | ) -4 | +4 | 5 | a = (🐶 + | ^^ Syntax Error: Got unexpected token 🐶 6 | # comment diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap index 53bcf17493..3806947400 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_orelse_expr_0.py -snapshot_kind: text --- ## AST @@ -79,7 +78,7 @@ Module( 1 | # Missing orelse expression, followed by a statement 2 | x if expr else | ^ Syntax Error: Expected an expression -3 | +3 | 4 | def foo(): 5 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap index b3bdceb24d..21c4bce330 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_orelse_expr_1.py -snapshot_kind: text --- ## AST @@ -78,6 +77,6 @@ Module( 1 | # Missing orelse expression, followed by an expression 2 | x if expr else | ^ Syntax Error: Expected an expression -3 | +3 | 4 | 1 + 1 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap index 1ce6c350c0..e621d76610 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_test_expr_0.py -snapshot_kind: text --- ## AST @@ -79,7 +78,7 @@ Module( 1 | # Missing test expression, followed by a statement 2 | x if | ^ Syntax Error: Expected an expression -3 | +3 | 4 | def foo(): 5 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap index 493eb3ff34..1289e83843 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_test_expr_1.py -snapshot_kind: text --- ## AST @@ -78,6 +77,6 @@ Module( 1 | # Missing test expression, followed by an expression 2 | x if | ^ Syntax Error: Expected an expression -3 | +3 | 4 | 1 + 1 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap index 544681b1dd..dd35e9a27d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/if/recover.py -snapshot_kind: text --- ## AST @@ -330,7 +329,7 @@ Module( 4 | x if yield x else y 5 | x if yield from x else y | ^^^^^^^^^^^^ Syntax Error: Yield expression cannot be used here -6 | +6 | 7 | # Invalid orelse expression | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap index 7d90bb96bc..04b08939f3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/lambda_duplicate_parameters.py -snapshot_kind: text --- ## AST @@ -288,44 +287,44 @@ Module( | 1 | lambda a, a: 1 | ^ Syntax Error: Duplicate parameter "a" -2 | +2 | 3 | lambda a, *, a: 1 | | 1 | lambda a, a: 1 -2 | +2 | 3 | lambda a, *, a: 1 | ^ Syntax Error: Duplicate parameter "a" -4 | +4 | 5 | lambda a, a=20: 1 | | 3 | lambda a, *, a: 1 -4 | +4 | 5 | lambda a, a=20: 1 | ^ Syntax Error: Duplicate parameter "a" -6 | +6 | 7 | lambda a, *a: 1 | | 5 | lambda a, a=20: 1 -6 | +6 | 7 | lambda a, *a: 1 | ^ Syntax Error: Duplicate parameter "a" -8 | +8 | 9 | lambda a, *, **a: 1 | | 7 | lambda a, *a: 1 -8 | +8 | 9 | lambda a, *, **a: 1 | ^^^ Syntax Error: Expected one or more keyword parameter after '*' separator | @@ -333,7 +332,7 @@ Module( | 7 | lambda a, *a: 1 -8 | +8 | 9 | lambda a, *, **a: 1 | ^ Syntax Error: Duplicate parameter "a" | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap index 55cc0ad09c..124079789d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/list/comprehension.py -snapshot_kind: text --- ## AST @@ -680,7 +679,7 @@ Module( 1 | # Iterable unpacking not allowed 2 | [*x for x in y] | ^^ Syntax Error: Iterable unpacking cannot be used in a comprehension -3 | +3 | 4 | # Invalid target | @@ -718,7 +717,7 @@ Module( 7 | [x for call() in y] 8 | [x for {a, b} in y] | ^^^^^^ Syntax Error: Invalid assignment target - 9 | + 9 | 10 | # Invalid iter | @@ -756,7 +755,7 @@ Module( 13 | [x for x in yield from y] 14 | [x for x in lambda y: y] | ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here -15 | +15 | 16 | # Invalid if | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap index 31e09c2ac2..9a64dd38fc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/list/missing_closing_bracket_3.py -snapshot_kind: text --- ## AST @@ -75,10 +74,10 @@ Module( | 2 | # token starts a statement. -3 | +3 | 4 | [1, 2 | ^ Syntax Error: Expected ']', found newline -5 | +5 | 6 | def foo(): 7 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap index ff1876c1cc..a3979fcf8a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/list/recover.py -snapshot_kind: text --- ## AST @@ -242,30 +241,30 @@ Module( | 1 | # Test cases for list expressions where the parser recovers from a syntax error. -2 | +2 | 3 | [,] | ^ Syntax Error: Expected an expression -4 | +4 | 5 | [1,,2] | | 3 | [,] -4 | +4 | 5 | [1,,2] | ^ Syntax Error: Expected an expression or a ']' -6 | +6 | 7 | [1,,] | | 5 | [1,,2] -6 | +6 | 7 | [1,,] | ^ Syntax Error: Expected an expression or a ']' -8 | +8 | 9 | # Missing comma | @@ -274,7 +273,7 @@ Module( 9 | # Missing comma 10 | [1 2] | ^ Syntax Error: Expected ',', found int -11 | +11 | 12 | # Dictionary element in a list | @@ -283,7 +282,7 @@ Module( 12 | # Dictionary element in a list 13 | [1: 2] | ^ Syntax Error: Expected an expression or a ']' -14 | +14 | 15 | # Missing expression | @@ -292,24 +291,24 @@ Module( 15 | # Missing expression 16 | [1, x + ] | ^ Syntax Error: Expected an expression -17 | +17 | 18 | [1; 2] | | 16 | [1, x + ] -17 | +17 | 18 | [1; 2] | ^ Syntax Error: Expected an expression or a ']' -19 | +19 | 20 | [*] | | 18 | [1; 2] -19 | +19 | 20 | [*] | ^ Syntax Error: Expected an expression | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap index 2f6b32a6ae..97dfb3722e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/list/star_expression_precedence.py -snapshot_kind: text --- ## AST @@ -394,7 +393,7 @@ Module( | 1 | # For list expression, the minimum binding power of star expression is bitwise or. -2 | +2 | 3 | [(*x), y] | ^^ Syntax Error: Starred expression cannot be used here 4 | [*x in y, z] diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap index 038635fa8d..c10ee4aac8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/named/invalid_target.py -snapshot_kind: text --- ## AST @@ -178,7 +177,7 @@ Module( | 1 | # Assignment expression target can only be an identifier -2 | +2 | 3 | (x.y := 1) | ^^^ Syntax Error: Assignment expression target must be an identifier 4 | (x[y] := 1) diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap index 3bb178d843..8f056e9ec5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/named/missing_expression_4.py -snapshot_kind: text --- ## AST @@ -67,9 +66,9 @@ Module( | 1 | # No expression on the right side of the assignment expression -2 | +2 | 3 | (x := ) | ^ Syntax Error: Expected an expression -4 | +4 | 5 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap index 091cd8c26a..9afe7ee6e7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/missing_closing_paren_3.py -snapshot_kind: text --- ## AST @@ -76,10 +75,10 @@ Module( | 2 | # token starts a statement. -3 | +3 | 4 | (1, 2 | ^ Syntax Error: Expected ')', found newline -5 | +5 | 6 | def foo(): 7 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap index e4ede8da48..c61c600e25 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/parenthesized.py -snapshot_kind: text --- ## AST @@ -63,7 +62,7 @@ Module( 1 | # Starred expression isn't allowed in a parenthesized expression. 2 | (*x) | ^^ Syntax Error: Starred expression cannot be used here -3 | +3 | 4 | # Unparenthesized named expression is allowed. | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap index 225d5bf70c..e621345669 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple.py -snapshot_kind: text --- ## AST @@ -251,30 +250,30 @@ Module( | 1 | # Test cases for tuple expressions where the parser recovers from a syntax error. -2 | +2 | 3 | (,) | ^ Syntax Error: Expected an expression -4 | +4 | 5 | (1,,2) | | 3 | (,) -4 | +4 | 5 | (1,,2) | ^ Syntax Error: Expected an expression or a ')' -6 | +6 | 7 | (1,,) | | 5 | (1,,2) -6 | +6 | 7 | (1,,) | ^ Syntax Error: Expected an expression or a ')' -8 | +8 | 9 | # Missing comma | @@ -283,7 +282,7 @@ Module( 9 | # Missing comma 10 | (1 2) | ^ Syntax Error: Expected ')', found int -11 | +11 | 12 | # Dictionary element in a list | @@ -292,7 +291,7 @@ Module( 9 | # Missing comma 10 | (1 2) | ^ Syntax Error: Expected a statement -11 | +11 | 12 | # Dictionary element in a list | @@ -301,7 +300,7 @@ Module( 9 | # Missing comma 10 | (1 2) | ^ Syntax Error: Expected a statement -11 | +11 | 12 | # Dictionary element in a list 13 | (1: 2) | @@ -311,7 +310,7 @@ Module( 12 | # Dictionary element in a list 13 | (1: 2) | ^ Syntax Error: Expected ')', found ':' -14 | +14 | 15 | # Missing expression | @@ -320,7 +319,7 @@ Module( 12 | # Dictionary element in a list 13 | (1: 2) | ^ Syntax Error: Invalid annotated assignment target -14 | +14 | 15 | # Missing expression | @@ -329,7 +328,7 @@ Module( 12 | # Dictionary element in a list 13 | (1: 2) | ^ Syntax Error: Expected a statement -14 | +14 | 15 | # Missing expression | @@ -338,7 +337,7 @@ Module( 12 | # Dictionary element in a list 13 | (1: 2) | ^ Syntax Error: Expected a statement -14 | +14 | 15 | # Missing expression 16 | (1, x + ) | @@ -348,37 +347,37 @@ Module( 15 | # Missing expression 16 | (1, x + ) | ^ Syntax Error: Expected an expression -17 | +17 | 18 | (1; 2) | | 16 | (1, x + ) -17 | +17 | 18 | (1; 2) | ^ Syntax Error: Expected ')', found ';' -19 | +19 | 20 | # Unparenthesized named expression is not allowed | | 16 | (1, x + ) -17 | +17 | 18 | (1; 2) | ^ Syntax Error: Expected a statement -19 | +19 | 20 | # Unparenthesized named expression is not allowed | | 16 | (1, x + ) -17 | +17 | 18 | (1; 2) | ^ Syntax Error: Expected a statement -19 | +19 | 20 | # Unparenthesized named expression is not allowed 21 | x, y := 2, z | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap index 24fada07a6..4b75ea06ed 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple_starred_expr.py -snapshot_kind: text --- ## AST @@ -1119,7 +1118,7 @@ Module( | 2 | # Test the first and any other element as the there are two separate calls. -3 | +3 | 4 | (*x in y, z, *x in y) | ^^^^^^ Syntax Error: Comparison expression cannot be used here 5 | (*not x, z, *not x) @@ -1129,7 +1128,7 @@ Module( | 2 | # Test the first and any other element as the there are two separate calls. -3 | +3 | 4 | (*x in y, z, *x in y) | ^^^^^^ Syntax Error: Comparison expression cannot be used here 5 | (*not x, z, *not x) diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap index 85ce25515b..b692643db9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/set/comprehension.py -snapshot_kind: text --- ## AST @@ -680,7 +679,7 @@ Module( 1 | # Iterable unpacking not allowed 2 | {*x for x in y} | ^^ Syntax Error: Iterable unpacking cannot be used in a comprehension -3 | +3 | 4 | # Invalid target | @@ -718,7 +717,7 @@ Module( 7 | {x for call() in y} 8 | {x for {a, b} in y} | ^^^^^^ Syntax Error: Invalid assignment target - 9 | + 9 | 10 | # Invalid iter | @@ -756,7 +755,7 @@ Module( 13 | {x for x in yield from y} 14 | {x for x in lambda y: y} | ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here -15 | +15 | 16 | # Invalid if | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap index 77cac8b028..f0ac8ba0d9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/set/missing_closing_curly_brace_3.py -snapshot_kind: text --- ## AST @@ -74,10 +73,10 @@ Module( | 2 | # token starts a statement. -3 | +3 | 4 | {1, 2 | ^ Syntax Error: Expected '}', found newline -5 | +5 | 6 | def foo(): 7 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap index 641af13e09..6df00c1bc5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/set/recover.py -snapshot_kind: text --- ## AST @@ -239,30 +238,30 @@ Module( | 3 | # These are same as for the list expressions. -4 | +4 | 5 | {,} | ^ Syntax Error: Expected an expression -6 | +6 | 7 | {1,,2} | | 5 | {,} -6 | +6 | 7 | {1,,2} | ^ Syntax Error: Expected an expression or a '}' -8 | +8 | 9 | {1,,} | | 7 | {1,,2} - 8 | + 8 | 9 | {1,,} | ^ Syntax Error: Expected an expression or a '}' -10 | +10 | 11 | # Missing comma | @@ -271,7 +270,7 @@ Module( 11 | # Missing comma 12 | {1 2} | ^ Syntax Error: Expected ',', found int -13 | +13 | 14 | # Dictionary element in a list | @@ -280,24 +279,24 @@ Module( 17 | # Missing expression 18 | {1, x + } | ^ Syntax Error: Expected an expression -19 | +19 | 20 | {1; 2} | | 18 | {1, x + } -19 | +19 | 20 | {1; 2} | ^ Syntax Error: Expected an expression or a '}' -21 | +21 | 22 | [*] | | 20 | {1; 2} -21 | +21 | 22 | [*] | ^ Syntax Error: Expected an expression | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap index 1b82f1b470..5fd3b81e29 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/set/star_expression_precedence.py -snapshot_kind: text --- ## AST @@ -386,7 +385,7 @@ Module( | 1 | # For set expression, the minimum binding power of star expression is bitwise or. -2 | +2 | 3 | {(*x), y} | ^^ Syntax Error: Starred expression cannot be used here 4 | {*x in y, z} diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap index 40b23ecf3f..598a1ba08e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/subscript/invalid_slice_element.py -snapshot_kind: text --- ## AST @@ -255,7 +254,7 @@ Module( | 1 | x[x := 1:] | ^^^^^^ Syntax Error: Unparenthesized named expression cannot be used here -2 | +2 | 3 | # Starred expression | @@ -283,7 +282,7 @@ Module( 5 | x[:*x] 6 | x[::*x] | ^^ Syntax Error: Starred expression cannot be used here -7 | +7 | 8 | # Empty slice | @@ -292,7 +291,7 @@ Module( 8 | # Empty slice 9 | x[] | ^ Syntax Error: Expected index or slice expression -10 | +10 | 11 | # Mixed starred expression and named expression | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap index b742a1c320..3ea59b57e8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/unary/no_expression_0.py -snapshot_kind: text --- ## AST @@ -62,6 +61,6 @@ Module( | 1 | not | ^ Syntax Error: Expected an expression -2 | +2 | 3 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap index 6a4778efd2..62d13301c9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/unary/no_expression_1.py -snapshot_kind: text --- ## AST @@ -62,6 +61,6 @@ Module( | 1 | + | ^ Syntax Error: Expected an expression -2 | +2 | 3 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap index 41b3250f97..84e07f14e9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/yield/named_expression.py -snapshot_kind: text --- ## AST @@ -104,14 +103,14 @@ Module( 1 | # Unparenthesized named expressions are not allowed 2 | yield x := 1 | ^^ Syntax Error: Expected a statement -3 | +3 | 4 | yield 1, x := 2, 3 | | 2 | yield x := 1 -3 | +3 | 4 | yield 1, x := 2, 3 | ^^ Syntax Error: Expected ',', found ':=' | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap index f6bf002f56..99a626da4e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/yield/star_expression.py -snapshot_kind: text --- ## AST @@ -101,14 +100,14 @@ Module( 1 | # Cannot use starred expression here 2 | yield (*x) | ^^ Syntax Error: Starred expression cannot be used here -3 | +3 | 4 | yield *x and y, z | | 2 | yield (*x) -3 | +3 | 4 | yield *x and y, z | ^^^^^^^ Syntax Error: Boolean expression cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap index 507caa1e49..4adf70d811 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/yield_from/starred_expression.py -snapshot_kind: text --- ## AST @@ -80,7 +79,7 @@ Module( | 1 | # Yield from doesn't allow top-level starred expression unlike yield -2 | +2 | 3 | yield from *x | ^^ Syntax Error: Starred expression cannot be used here 4 | yield from *x, y diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap index 6a482405dc..40ffb45e66 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/expressions/yield_from/unparenthesized.py -snapshot_kind: text --- ## AST @@ -137,7 +136,7 @@ Module( 1 | # Unparenthesized named expression 2 | yield from x := 1 | ^^ Syntax Error: Expected a statement -3 | +3 | 4 | # Unparenthesized tuple expression | @@ -146,7 +145,7 @@ Module( 4 | # Unparenthesized tuple expression 5 | yield from x, y | ^^^^ Syntax Error: Unparenthesized tuple expression cannot be used here -6 | +6 | 7 | # This is a tuple expression parsing | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap index e2bfe5cd60..abeaef0f13 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/re_lexing/line_continuation_1.py -snapshot_kind: text --- ## AST @@ -84,7 +83,7 @@ Module( | 1 | call(a, b, \\\ | ^ Syntax Error: Expected a newline after line continuation character -2 | +2 | 3 | def bar(): | @@ -92,14 +91,14 @@ Module( | 1 | call(a, b, \\\ | ^ Syntax Error: Expected a newline after line continuation character -2 | +2 | 3 | def bar(): | | 1 | call(a, b, \\\ -2 | +2 | | ^ Syntax Error: Expected ')', found newline 3 | def bar(): 4 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap index b1ed4a65c4..0c547eb7b4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/statements/function_type_parameters.py -snapshot_kind: text --- ## AST @@ -324,57 +323,57 @@ Module( | 9 | # on following lines. -10 | +10 | 11 | def keyword[A, await](): ... | ^^^^^ Syntax Error: Expected an identifier, but found a keyword 'await' that cannot be used here -12 | +12 | 13 | def not_a_type_param[A, |, B](): ... | | 11 | def keyword[A, await](): ... -12 | +12 | 13 | def not_a_type_param[A, |, B](): ... | ^ Syntax Error: Expected ',', found '|' -14 | +14 | 15 | def multiple_commas[A,,B](): ... | | 11 | def keyword[A, await](): ... -12 | +12 | 13 | def not_a_type_param[A, |, B](): ... | ^ Syntax Error: Expected a type parameter or the end of the type parameter list -14 | +14 | 15 | def multiple_commas[A,,B](): ... | | 13 | def not_a_type_param[A, |, B](): ... -14 | +14 | 15 | def multiple_commas[A,,B](): ... | ^ Syntax Error: Expected a type parameter or the end of the type parameter list -16 | +16 | 17 | def multiple_trailing_commas[A,,](): ... | | 15 | def multiple_commas[A,,B](): ... -16 | +16 | 17 | def multiple_trailing_commas[A,,](): ... | ^ Syntax Error: Expected a type parameter or the end of the type parameter list -18 | +18 | 19 | def multiple_commas_and_recovery[A,,100](): ... | | 17 | def multiple_trailing_commas[A,,](): ... -18 | +18 | 19 | def multiple_commas_and_recovery[A,,100](): ... | ^ Syntax Error: Expected a type parameter or the end of the type parameter list | @@ -382,7 +381,7 @@ Module( | 17 | def multiple_trailing_commas[A,,](): ... -18 | +18 | 19 | def multiple_commas_and_recovery[A,,100](): ... | ^^^ Syntax Error: Expected ']', found int | @@ -390,7 +389,7 @@ Module( | 17 | def multiple_trailing_commas[A,,](): ... -18 | +18 | 19 | def multiple_commas_and_recovery[A,,100](): ... | ^ Syntax Error: Expected newline, found ']' | @@ -398,7 +397,7 @@ Module( | 17 | def multiple_trailing_commas[A,,](): ... -18 | +18 | 19 | def multiple_commas_and_recovery[A,,100](): ... | ^^ Syntax Error: Only single target (not tuple) can be annotated | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap index c5e9b195e3..14d38462fb 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/statements/invalid_assignment_targets.py -snapshot_kind: text --- ## AST @@ -1383,30 +1382,30 @@ Module( | 3 | # rejected by the parser. e.g., `5 = 3`, `5 += 3`, `(5): int = 3`. -4 | +4 | 5 | 5 = 3 | ^ Syntax Error: Invalid assignment target -6 | +6 | 7 | 5 += 3 | | 5 | 5 = 3 -6 | +6 | 7 | 5 += 3 | ^ Syntax Error: Invalid augmented assignment target -8 | +8 | 9 | (5): int = 3 | | 7 | 5 += 3 - 8 | + 8 | 9 | (5): int = 3 | ^ Syntax Error: Invalid annotated assignment target -10 | +10 | 11 | # Now we exhaustively test all possible cases where assignment can fail. | @@ -1574,14 +1573,14 @@ Module( 27 | a < b < c = 42 28 | foo() = 42 | ^^^^^ Syntax Error: Invalid assignment target -29 | +29 | 30 | f"{quux}" = 42 | | 28 | foo() = 42 -29 | +29 | 30 | f"{quux}" = 42 | ^^^^^^^^^ Syntax Error: Invalid assignment target 31 | f"{foo} and {bar}" = 42 @@ -1592,14 +1591,14 @@ Module( 30 | f"{quux}" = 42 31 | f"{foo} and {bar}" = 42 | ^^^^^^^^^^^^^^^^^^ Syntax Error: Invalid assignment target -32 | +32 | 33 | "foo" = 42 | | 31 | f"{foo} and {bar}" = 42 -32 | +32 | 33 | "foo" = 42 | ^^^^^ Syntax Error: Invalid assignment target 34 | b"foo" = 42 diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap index 6602a88e64..4fa30fed7b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/statements/invalid_augmented_assignment_target.py -snapshot_kind: text --- ## AST @@ -1278,7 +1277,7 @@ Module( | 2 | # assignment targets. -3 | +3 | 4 | x or y += 42 | ^^^^^^ Syntax Error: Invalid augmented assignment target 5 | (x := 5) += 42 @@ -1439,14 +1438,14 @@ Module( 19 | a < b < c += 42 20 | foo() += 42 | ^^^^^ Syntax Error: Invalid augmented assignment target -21 | +21 | 22 | f"{quux}" += 42 | | 20 | foo() += 42 -21 | +21 | 22 | f"{quux}" += 42 | ^^^^^^^^^ Syntax Error: Invalid augmented assignment target 23 | f"{foo} and {bar}" += 42 @@ -1457,14 +1456,14 @@ Module( 22 | f"{quux}" += 42 23 | f"{foo} and {bar}" += 42 | ^^^^^^^^^^^^^^^^^^ Syntax Error: Invalid augmented assignment target -24 | +24 | 25 | "foo" += 42 | | 23 | f"{foo} and {bar}" += 42 -24 | +24 | 25 | "foo" += 42 | ^^^^^ Syntax Error: Invalid augmented assignment target 26 | b"foo" += 42 diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap index 78edca9d8e..e05f49c03b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/statements/with/ambiguous_lpar_with_items.py -snapshot_kind: text --- ## AST @@ -1362,7 +1361,7 @@ Module( | 2 | # These cases should raise the correct syntax error and recover properly. -3 | +3 | 4 | with (item1, item2),: ... | ^ Syntax Error: Trailing comma not allowed 5 | with (item1, item2), as f: ... @@ -1452,7 +1451,7 @@ Module( 11 | with (x for x in range(10), item): ... 12 | with (item, x for x in range(10)): ... | ^^^ Syntax Error: Expected ')', found 'for' -13 | +13 | 14 | # Make sure the parser doesn't report the same error twice | @@ -1462,7 +1461,7 @@ Module( 11 | with (x for x in range(10), item): ... 12 | with (item, x for x in range(10)): ... | ^ Syntax Error: Expected ':', found ')' -13 | +13 | 14 | # Make sure the parser doesn't report the same error twice | @@ -1472,7 +1471,7 @@ Module( 11 | with (x for x in range(10), item): ... 12 | with (item, x for x in range(10)): ... | ^ Syntax Error: Expected a statement -13 | +13 | 14 | # Make sure the parser doesn't report the same error twice | @@ -1481,14 +1480,14 @@ Module( 14 | # Make sure the parser doesn't report the same error twice 15 | with ((*item)): ... | ^^^^^ Syntax Error: Starred expression cannot be used here -16 | +16 | 17 | with (*x for x in iter, item): ... | | 15 | with ((*item)): ... -16 | +16 | 17 | with (*x for x in iter, item): ... | ^^ Syntax Error: Iterable unpacking cannot be used in a comprehension 18 | with (item1, *x for x in iter, item2): ... @@ -1498,7 +1497,7 @@ Module( | 15 | with ((*item)): ... -16 | +16 | 17 | with (*x for x in iter, item): ... | ^ Syntax Error: Expected ')', found ',' 18 | with (item1, *x for x in iter, item2): ... @@ -1508,7 +1507,7 @@ Module( | 15 | with ((*item)): ... -16 | +16 | 17 | with (*x for x in iter, item): ... | ^ Syntax Error: Expected ',', found ')' 18 | with (item1, *x for x in iter, item2): ... @@ -1607,7 +1606,7 @@ Module( 24 | with (x as f, y) as f: ... 25 | with (x for x in iter as y): ... | ^^ Syntax Error: Expected ')', found 'as' -26 | +26 | 27 | # The inner `(...)` is parsed as parenthesized expression | @@ -1617,7 +1616,7 @@ Module( 24 | with (x as f, y) as f: ... 25 | with (x for x in iter as y): ... | ^ Syntax Error: Expected ',', found ')' -26 | +26 | 27 | # The inner `(...)` is parsed as parenthesized expression | @@ -1626,7 +1625,7 @@ Module( 27 | # The inner `(...)` is parsed as parenthesized expression 28 | with ((item as f)): ... | ^^ Syntax Error: Expected ')', found 'as' -29 | +29 | 30 | with (item as f), x: ... | @@ -1635,7 +1634,7 @@ Module( 27 | # The inner `(...)` is parsed as parenthesized expression 28 | with ((item as f)): ... | ^ Syntax Error: Expected ':', found ')' -29 | +29 | 30 | with (item as f), x: ... | @@ -1644,14 +1643,14 @@ Module( 27 | # The inner `(...)` is parsed as parenthesized expression 28 | with ((item as f)): ... | ^ Syntax Error: Expected a statement -29 | +29 | 30 | with (item as f), x: ... | | 28 | with ((item as f)): ... -29 | +29 | 30 | with (item as f), x: ... | ^ Syntax Error: Expected ':', found ',' 31 | with (item as f1) as f2: ... diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap index 4a2405c4ff..9d3a53afb0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/statements/with/empty_with_items.py -snapshot_kind: text --- ## AST @@ -62,9 +61,9 @@ Module( | 2 | # The parser should recover from this syntax error. -3 | +3 | 4 | with : ... | ^ Syntax Error: Expected the start of an expression after `with` keyword -5 | +5 | 6 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap index f0c47e8310..7182e64ab1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap @@ -1,7 +1,6 @@ --- source: crates/ruff_python_parser/tests/fixtures.rs input_file: crates/ruff_python_parser/resources/invalid/statements/with/unparenthesized_with_items.py -snapshot_kind: text --- ## AST @@ -298,7 +297,7 @@ Module( | 1 | # For parenthesized with items test cases, refer to `./ambiguous_lpar_with_items.py` -2 | +2 | 3 | with item,: pass | ^ Syntax Error: Trailing comma not allowed 4 | with item as x,: pass