From f72ed255e58ea33588dc47140e8be62f0536816f Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 20 Feb 2023 21:13:37 +0100 Subject: [PATCH] chore: Use `LF` on all platforms (#3005) I worked on #2993 and ran into issues that the formatter tests are failing on Windows because `writeln!` emits `\n` as line terminator on all platforms, but `git` on Windows converted the line endings in the snapshots to `\r\n`. I then tried to replicate the issue on my Windows machine and was surprised that all linter snapshot tests are failing on my machine. I figured out after some time that it is due to my global git config keeping the input line endings rather than converting to `\r\n`. Luckily, I've been made aware of #2033 which introduced an "override" for the `assert_yaml_snapshot` macro that normalizes new lines, by splitting the formatted string using the platform-specific newline character. This is a clever approach and gives nice diffs for multiline fixes but makes assumptions about the setup contributors use and requires special care whenever we use line endings inside of tests. I recommend that we remove the special new line handling and use `.gitattributes` to enforce the use of `LF` on all platforms [guide](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings). This gives us platform agnostic tests without having to worry about line endings in our tests or different git configurations. ## Note It may be necessary for Windows contributors to run the following command to update the line endings of their files ```bash git rm --cached -r . git reset --hard ``` --- .gitattributes | 6 + .../test/fixtures/isort/line_ending_crlf.py | 2 +- .../test/fixtures/pycodestyle/W605_1.py | 70 +++++----- crates/ruff/src/assert_yaml_snapshot.rs | 18 --- crates/ruff/src/lib.rs | 1 - crates/ruff/src/rules/eradicate/mod.rs | 3 +- ...s__eradicate__tests__ERA001_ERA001.py.snap | 17 +-- crates/ruff/src/rules/flake8_2020/mod.rs | 3 +- .../ruff/src/rules/flake8_annotations/mod.rs | 2 +- crates/ruff/src/rules/flake8_bandit/mod.rs | 2 +- .../ruff/src/rules/flake8_blind_except/mod.rs | 3 +- .../ruff/src/rules/flake8_boolean_trap/mod.rs | 3 +- crates/ruff/src/rules/flake8_bugbear/mod.rs | 2 +- ...__flake8_bugbear__tests__B007_B007.py.snap | 17 +-- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 23 ++- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 20 +-- ...__flake8_bugbear__tests__B011_B011.py.snap | 6 +- ...__flake8_bugbear__tests__B013_B013.py.snap | 5 +- ...__flake8_bugbear__tests__B014_B014.py.snap | 11 +- crates/ruff/src/rules/flake8_builtins/mod.rs | 2 +- crates/ruff/src/rules/flake8_commas/mod.rs | 3 +- ...rules__flake8_commas__tests__COM81.py.snap | 128 ++++++----------- .../src/rules/flake8_comprehensions/mod.rs | 3 +- ...8_comprehensions__tests__C400_C400.py.snap | 10 +- ...8_comprehensions__tests__C401_C401.py.snap | 17 +-- ...8_comprehensions__tests__C402_C402.py.snap | 14 +- ...8_comprehensions__tests__C403_C403.py.snap | 10 +- ...8_comprehensions__tests__C404_C404.py.snap | 5 +- ...8_comprehensions__tests__C405_C405.py.snap | 33 ++--- ...8_comprehensions__tests__C406_C406.py.snap | 14 +- ...8_comprehensions__tests__C408_C408.py.snap | 14 +- ...low_dict_calls_with_keyword_arguments.snap | 9 +- ...8_comprehensions__tests__C409_C409.py.snap | 20 +-- ...8_comprehensions__tests__C410_C410.py.snap | 14 +- ...8_comprehensions__tests__C411_C411.py.snap | 5 +- ...8_comprehensions__tests__C413_C413.py.snap | 21 +-- ...8_comprehensions__tests__C414_C414.py.snap | 45 ++---- ...8_comprehensions__tests__C416_C416.py.snap | 8 +- ...8_comprehensions__tests__C417_C417.py.snap | 36 ++--- crates/ruff/src/rules/flake8_datetimez/mod.rs | 3 +- crates/ruff/src/rules/flake8_debugger/mod.rs | 3 +- crates/ruff/src/rules/flake8_django/mod.rs | 3 +- crates/ruff/src/rules/flake8_errmsg/mod.rs | 3 +- .../ruff/src/rules/flake8_executable/mod.rs | 3 +- ...flake8_executable__tests__EXE004_1.py.snap | 5 +- .../rules/flake8_implicit_str_concat/mod.rs | 3 +- .../rules/flake8_import_conventions/mod.rs | 2 +- crates/ruff/src/rules/flake8_no_pep420/mod.rs | 2 +- crates/ruff/src/rules/flake8_pie/mod.rs | 3 +- ...__flake8_pie__tests__PIE790_PIE790.py.snap | 51 +++---- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 14 +- ...__flake8_pie__tests__PIE807_PIE807.py.snap | 11 +- crates/ruff/src/rules/flake8_print/mod.rs | 3 +- crates/ruff/src/rules/flake8_pyi/mod.rs | 3 +- .../ruff/src/rules/flake8_pytest_style/mod.rs | 3 +- ...e8_pytest_style__tests__PT001_default.snap | 11 +- ...st_style__tests__PT001_no_parentheses.snap | 20 +-- ...es__flake8_pytest_style__tests__PT003.snap | 26 ++-- ...flake8_pytest_style__tests__PT006_csv.snap | 14 +- ...e8_pytest_style__tests__PT006_default.snap | 26 ++-- ...lake8_pytest_style__tests__PT006_list.snap | 20 +-- ...es__flake8_pytest_style__tests__PT009.snap | 72 ++++------ ...es__flake8_pytest_style__tests__PT018.snap | 38 ++--- ...es__flake8_pytest_style__tests__PT022.snap | 5 +- ...e8_pytest_style__tests__PT023_default.snap | 17 +-- ...st_style__tests__PT023_no_parentheses.snap | 17 +-- ...es__flake8_pytest_style__tests__PT024.snap | 14 +- ...es__flake8_pytest_style__tests__PT025.snap | 8 +- ...es__flake8_pytest_style__tests__PT026.snap | 8 +- crates/ruff/src/rules/flake8_quotes/mod.rs | 2 +- ...ing_doubles_over_docstring_doubles.py.snap | 26 +--- ...ubles_over_docstring_doubles_class.py.snap | 8 +- ...es_over_docstring_doubles_function.py.snap | 19 +-- ...docstring_doubles_module_multiline.py.snap | 12 +- ...ocstring_doubles_module_singleline.py.snap | 8 +- ...ing_doubles_over_docstring_singles.py.snap | 17 +-- ...ubles_over_docstring_singles_class.py.snap | 11 +- ...es_over_docstring_singles_function.py.snap | 13 +- ...docstring_singles_module_multiline.py.snap | 7 +- ...ocstring_singles_module_singleline.py.snap | 5 +- ...ing_singles_over_docstring_doubles.py.snap | 17 +-- ...ngles_over_docstring_doubles_class.py.snap | 11 +- ...es_over_docstring_doubles_function.py.snap | 13 +- ...docstring_doubles_module_multiline.py.snap | 7 +- ...ocstring_doubles_module_singleline.py.snap | 5 +- ...ing_singles_over_docstring_singles.py.snap | 31 +--- ...ngles_over_docstring_singles_class.py.snap | 8 +- ...es_over_docstring_singles_function.py.snap | 19 +-- ...docstring_singles_module_multiline.py.snap | 12 +- ...ocstring_singles_module_singleline.py.snap | 8 +- ...ests__require_doubles_over_singles.py.snap | 11 +- ...quire_doubles_over_singles_escaped.py.snap | 6 +- ...uire_doubles_over_singles_implicit.py.snap | 23 ++- ...bles_over_singles_multiline_string.py.snap | 7 +- ...ests__require_singles_over_doubles.py.snap | 11 +- ...quire_singles_over_doubles_escaped.py.snap | 9 +- ...uire_singles_over_doubles_implicit.py.snap | 23 ++- ...gles_over_doubles_multiline_string.py.snap | 7 +- crates/ruff/src/rules/flake8_raise/mod.rs | 3 +- ...ry-paren-on-raise-exception_RSE102.py.snap | 18 +-- crates/ruff/src/rules/flake8_return/mod.rs | 2 +- ...lake8_return__tests__RET501_RET501.py.snap | 5 +- ...lake8_return__tests__RET502_RET502.py.snap | 5 +- ...lake8_return__tests__RET503_RET503.py.snap | 52 ++----- crates/ruff/src/rules/flake8_self/mod.rs | 3 +- crates/ruff/src/rules/flake8_simplify/mod.rs | 3 +- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 20 +-- ...ke8_simplify__tests__SIM102_SIM102.py.snap | 71 ++-------- ...ke8_simplify__tests__SIM103_SIM103.py.snap | 12 +- ...ke8_simplify__tests__SIM108_SIM108.py.snap | 6 +- ...ke8_simplify__tests__SIM109_SIM109.py.snap | 14 +- ...ke8_simplify__tests__SIM110_SIM110.py.snap | 27 ++-- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 33 ++--- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 14 +- ...ke8_simplify__tests__SIM117_SIM117.py.snap | 57 +------- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 29 ++-- ...ke8_simplify__tests__SIM201_SIM201.py.snap | 11 +- ...ke8_simplify__tests__SIM202_SIM202.py.snap | 11 +- ...ke8_simplify__tests__SIM208_SIM208.py.snap | 8 +- ...ke8_simplify__tests__SIM210_SIM210.py.snap | 11 +- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 11 +- ...ke8_simplify__tests__SIM212_SIM212.py.snap | 8 +- ...ke8_simplify__tests__SIM220_SIM220.py.snap | 11 +- ...ke8_simplify__tests__SIM221_SIM221.py.snap | 11 +- ...ke8_simplify__tests__SIM222_SIM222.py.snap | 11 +- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 11 +- ...ke8_simplify__tests__SIM300_SIM300.py.snap | 38 ++--- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 18 +-- .../rules/flake8_tidy_imports/banned_api.rs | 2 +- .../flake8_tidy_imports/relative_imports.rs | 2 +- ...ts__tests__ban_parent_imports_package.snap | 15 +- .../src/rules/flake8_type_checking/mod.rs | 3 +- ...__empty-type-checking-block_TCH005.py.snap | 15 +- .../src/rules/flake8_unused_arguments/mod.rs | 3 +- crates/ruff/src/rules/isort/mod.rs | 3 +- ...tests__add_newline_before_comments.py.snap | 13 +- ...to_furthest_relative_imports_order.py.snap | 8 +- ...__isort__tests__combine_as_imports.py.snap | 8 +- ...bine_as_imports_combine_as_imports.py.snap | 6 +- ..._isort__tests__combine_import_from.py.snap | 13 +- ...ombined_required_imports_docstring.py.snap | 10 +- ...uff__rules__isort__tests__comments.py.snap | 28 +--- ..._isort__tests__deduplicate_imports.py.snap | 8 +- ...les__isort__tests__fit_line_length.py.snap | 21 +-- ...rt__tests__fit_line_length_comment.py.snap | 12 +- ...orce_single_line_force_single_line.py.snap | 25 +--- ..._tests__force_sort_within_sections.py.snap | 16 +-- ...ections_force_sort_within_sections.py.snap | 16 +-- ..._rules__isort__tests__force_to_top.py.snap | 22 +-- ...__tests__force_to_top_force_to_top.py.snap | 22 +-- ...__isort__tests__force_wrap_aliases.py.snap | 9 +- ...ce_wrap_aliases_force_wrap_aliases.py.snap | 11 +- ...les__isort__tests__forced_separate.py.snap | 13 +- ...t__tests__import_from_after_import.py.snap | 7 +- ...les__isort__tests__inline_comments.py.snap | 18 +-- ...__isort__tests__insert_empty_lines.py.snap | 27 +--- ..._isort__tests__insert_empty_lines.pyi.snap | 20 +-- ...lder_separate_local_folder_imports.py.snap | 10 +- ...ts_lines_after_imports_class_after.py.snap | 16 +-- ...rts_lines_after_imports_func_after.py.snap | 16 +-- ..._lines_after_imports_nothing_after.py.snap | 13 +- ...s_between_typeslines_between_types.py.snap | 19 +-- ...isort__tests__magic_trailing_comma.py.snap | 36 +---- ...rules__isort__tests__natural_order.py.snap | 21 +-- ...les__isort__tests__no_lines_before.py.snap | 13 +- ...no_lines_before.py_no_lines_before.py.snap | 10 +- ..._rules__isort__tests__no_wrap_star.py.snap | 6 +- ...rules__isort__tests__order_by_type.py.snap | 18 +-- ..._order_by_type_false_order_by_type.py.snap | 18 +-- ..._order_by_type_with_custom_classes.py.snap | 10 +- ..._order_by_type_with_custom_classes.py.snap | 10 +- ...rder_by_type_with_custom_constants.py.snap | 8 +- ...rder_by_type_with_custom_constants.py.snap | 8 +- ...rder_by_type_with_custom_variables.py.snap | 8 +- ...rder_by_type_with_custom_variables.py.snap | 8 +- ...s__order_relative_imports_by_level.py.snap | 9 +- ...ort__tests__preserve_comment_order.py.snap | 17 +-- ...isort__tests__preserve_import_star.py.snap | 12 +- ...isort__tests__preserve_indentation.py.snap | 12 +- ...ort__tests__reorder_within_section.py.snap | 7 +- ...__tests__required_import_docstring.py.snap | 6 +- ...equired_import_multiline_docstring.py.snap | 4 +- ..._tests__required_imports_docstring.py.snap | 10 +- ...ests__separate_first_party_imports.py.snap | 12 +- ...rt__tests__separate_future_imports.py.snap | 9 +- ...sts__separate_local_folder_imports.py.snap | 11 +- ...ests__separate_third_party_imports.py.snap | 10 +- .../ruff__rules__isort__tests__skip.py.snap | 12 +- ...isort__tests__sort_similar_imports.py.snap | 27 +--- ...railing_comma_magic_trailing_comma.py.snap | 23 +-- ...__isort__tests__star_before_others.py.snap | 8 +- ...straight_required_import_docstring.py.snap | 6 +- crates/ruff/src/rules/mccabe/mod.rs | 2 +- crates/ruff/src/rules/numpy/mod.rs | 3 +- ...numpy-deprecated-type-alias_NPY001.py.snap | 21 +-- crates/ruff/src/rules/pandas_vet/mod.rs | 3 +- ...es__pandas_vet__tests__PD002_PD002.py.snap | 20 +-- crates/ruff/src/rules/pep8_naming/mod.rs | 3 +- crates/ruff/src/rules/pycodestyle/mod.rs | 25 +++- ...ules__pycodestyle__tests__E703_E70.py.snap | 9 +- ...les__pycodestyle__tests__E711_E711.py.snap | 32 ++--- ...les__pycodestyle__tests__E712_E712.py.snap | 35 ++--- ...les__pycodestyle__tests__E713_E713.py.snap | 17 +-- ...les__pycodestyle__tests__E714_E714.py.snap | 8 +- ...les__pycodestyle__tests__E731_E731.py.snap | 20 +-- ...s__pycodestyle__tests__W292_W292_0.py.snap | 6 +- ...s__pycodestyle__tests__W605_W605_0.py.snap | 14 +- ...s__pycodestyle__tests__W605_W605_1.py.snap | 14 +- ...pycodestyle__tests__constant_literals.snap | 29 ++-- ...f__rules__pycodestyle__tests__w292_4.snap} | 6 +- crates/ruff/src/rules/pydocstyle/mod.rs | 3 +- ...__rules__pydocstyle__tests__D200_D.py.snap | 11 +- ...__rules__pydocstyle__tests__D201_D.py.snap | 14 +- ...__rules__pydocstyle__tests__D202_D.py.snap | 14 +- ...ules__pydocstyle__tests__D202_D202.py.snap | 9 +- ...__rules__pydocstyle__tests__D203_D.py.snap | 14 +- ...__rules__pydocstyle__tests__D204_D.py.snap | 10 +- ...__rules__pydocstyle__tests__D205_D.py.snap | 6 +- ...__rules__pydocstyle__tests__D207_D.py.snap | 14 +- ...__rules__pydocstyle__tests__D208_D.py.snap | 11 +- ...__rules__pydocstyle__tests__D209_D.py.snap | 10 +- ...__rules__pydocstyle__tests__D210_D.py.snap | 11 +- ...__rules__pydocstyle__tests__D211_D.py.snap | 8 +- ...__rules__pydocstyle__tests__D212_D.py.snap | 11 +- ...__rules__pydocstyle__tests__D213_D.py.snap | 90 +++--------- ...__pydocstyle__tests__D214_sections.py.snap | 5 +- ...__pydocstyle__tests__D215_sections.py.snap | 8 +- ...__rules__pydocstyle__tests__D400_D.py.snap | 47 +++---- ...ules__pydocstyle__tests__D400_D400.py.snap | 38 ++--- ...__pydocstyle__tests__D405_sections.py.snap | 8 +- ...__pydocstyle__tests__D406_sections.py.snap | 14 +- ...__pydocstyle__tests__D407_sections.py.snap | 62 +++----- ...__pydocstyle__tests__D408_sections.py.snap | 5 +- ...__pydocstyle__tests__D409_sections.py.snap | 10 +- ...__pydocstyle__tests__D410_sections.py.snap | 10 +- ...__pydocstyle__tests__D411_sections.py.snap | 14 +- ...__pydocstyle__tests__D412_sections.py.snap | 5 +- ...__rules__pydocstyle__tests__D415_D.py.snap | 44 ++---- crates/ruff/src/rules/pyflakes/mod.rs | 3 +- ...ules__pyflakes__tests__F401_F401_0.py.snap | 26 ++-- ...ules__pyflakes__tests__F401_F401_5.py.snap | 14 +- ...ules__pyflakes__tests__F401_F401_6.py.snap | 14 +- ...ules__pyflakes__tests__F401_F401_7.py.snap | 13 +- ...ules__pyflakes__tests__F401_F401_9.py.snap | 3 +- ..._rules__pyflakes__tests__F504_F504.py.snap | 11 +- ..._rules__pyflakes__tests__F504_F50x.py.snap | 5 +- ..._rules__pyflakes__tests__F522_F522.py.snap | 11 +- ..._rules__pyflakes__tests__F541_F541.py.snap | 45 ++---- ..._rules__pyflakes__tests__F601_F601.py.snap | 20 +-- ..._rules__pyflakes__tests__F602_F602.py.snap | 20 +-- ..._rules__pyflakes__tests__F632_F632.py.snap | 23 ++- ...ules__pyflakes__tests__F841_F841_0.py.snap | 21 +-- ...ules__pyflakes__tests__F841_F841_1.py.snap | 6 +- ...ules__pyflakes__tests__F841_F841_3.py.snap | 75 ++++------ ..._rules__pyflakes__tests__F901_F901.py.snap | 8 +- ...lakes__tests__f841_dummy_variable_rgx.snap | 27 ++-- ...__pyflakes__tests__future_annotations.snap | 7 +- ...yflakes__tests__multi_statement_lines.snap | 41 ++---- crates/ruff/src/rules/pygrep_hooks/mod.rs | 3 +- crates/ruff/src/rules/pylint/mod.rs | 2 +- ...nt__tests__PLC0414_import_aliasing.py.snap | 26 ++-- ...nt__tests__PLR0402_import_aliasing.py.snap | 8 +- ..._PLR1722_consider_using_sys_exit_1.py.snap | 14 +- ..._PLR1722_consider_using_sys_exit_2.py.snap | 14 +- ..._PLR1722_consider_using_sys_exit_3.py.snap | 8 +- ..._PLR1722_consider_using_sys_exit_4.py.snap | 14 +- ..._PLR1722_consider_using_sys_exit_5.py.snap | 8 +- crates/ruff/src/rules/pyupgrade/mod.rs | 3 +- ...ff__rules__pyupgrade__tests__UP001.py.snap | 6 +- ...ff__rules__pyupgrade__tests__UP003.py.snap | 15 +- ...ff__rules__pyupgrade__tests__UP004.py.snap | 60 +++----- ...ff__rules__pyupgrade__tests__UP005.py.snap | 12 +- ...ff__rules__pyupgrade__tests__UP006.py.snap | 12 +- ...ff__rules__pyupgrade__tests__UP007.py.snap | 21 +-- ...ff__rules__pyupgrade__tests__UP008.py.snap | 15 +- ...__rules__pyupgrade__tests__UP009_0.py.snap | 3 +- ...__rules__pyupgrade__tests__UP009_1.py.snap | 3 +- ...ff__rules__pyupgrade__tests__UP010.py.snap | 30 ++-- ...ff__rules__pyupgrade__tests__UP011.py.snap | 12 +- ...ff__rules__pyupgrade__tests__UP012.py.snap | 49 ++----- ...ff__rules__pyupgrade__tests__UP013.py.snap | 44 ++---- ...ff__rules__pyupgrade__tests__UP014.py.snap | 16 +-- ...ff__rules__pyupgrade__tests__UP015.py.snap | 132 ++++++------------ ...ff__rules__pyupgrade__tests__UP018.py.snap | 20 +-- ...ff__rules__pyupgrade__tests__UP019.py.snap | 12 +- ...ff__rules__pyupgrade__tests__UP021.py.snap | 12 +- ...ff__rules__pyupgrade__tests__UP022.py.snap | 23 +-- ...ff__rules__pyupgrade__tests__UP023.py.snap | 34 ++--- ...__rules__pyupgrade__tests__UP024_0.py.snap | 39 ++---- ...__rules__pyupgrade__tests__UP024_1.py.snap | 9 +- ...__rules__pyupgrade__tests__UP024_2.py.snap | 60 +++----- ...ff__rules__pyupgrade__tests__UP025.py.snap | 36 ++--- ...ff__rules__pyupgrade__tests__UP026.py.snap | 117 ++++------------ ...ff__rules__pyupgrade__tests__UP027.py.snap | 18 +-- ...__rules__pyupgrade__tests__UP028_0.py.snap | 40 ++---- ...ff__rules__pyupgrade__tests__UP029.py.snap | 12 +- ...__rules__pyupgrade__tests__UP030_0.py.snap | 30 ++-- ...__rules__pyupgrade__tests__UP030_2.py.snap | 33 ++--- ...__rules__pyupgrade__tests__UP031_0.py.snap | 95 ++++--------- ...ff__rules__pyupgrade__tests__UP032.py.snap | 66 +++------ ...ff__rules__pyupgrade__tests__UP033.py.snap | 9 +- ...ff__rules__pyupgrade__tests__UP034.py.snap | 32 ++--- ...ff__rules__pyupgrade__tests__UP035.py.snap | 63 +++------ ...__rules__pyupgrade__tests__UP036_0.py.snap | 110 ++++----------- ...__rules__pyupgrade__tests__UP036_1.py.snap | 43 ++---- ...__rules__pyupgrade__tests__UP036_2.py.snap | 36 ++--- ...__rules__pyupgrade__tests__UP036_3.py.snap | 13 +- ...__rules__pyupgrade__tests__UP036_4.py.snap | 24 ++-- ...ff__rules__pyupgrade__tests__UP037.py.snap | 87 ++++-------- ...rade__tests__datetime_utc_alias_py311.snap | 5 +- ...tests__future_annotations_pep_585_p37.snap | 3 +- ...sts__future_annotations_pep_585_py310.snap | 12 +- ...tests__future_annotations_pep_604_p37.snap | 3 +- ...sts__future_annotations_pep_604_py310.snap | 6 +- crates/ruff/src/rules/ruff/mod.rs | 3 +- ..._rules__ruff__tests__RUF005_RUF005.py.snap | 36 ++--- ...ruff__rules__ruff__tests__confusables.snap | 11 +- .../ruff__rules__ruff__tests__ruf100_0.snap | 41 ++---- .../ruff__rules__ruff__tests__ruf100_1.snap | 28 ++-- .../ruff__rules__ruff__tests__ruf100_2.snap | 5 +- ...ules__ruff__tests__ruff_targeted_noqa.snap | 3 +- crates/ruff/src/rules/tryceratops/mod.rs | 3 +- scripts/add_plugin.py | 3 +- 323 files changed, 1722 insertions(+), 3954 deletions(-) create mode 100644 .gitattributes delete mode 100644 crates/ruff/src/assert_yaml_snapshot.rs rename crates/ruff/src/rules/pycodestyle/snapshots/{ruff__rules__pycodestyle__tests__W292_W292_4.py.snap => ruff__rules__pycodestyle__tests__w292_4.snap} (76%) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..5bb8d8b736 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +* text=auto eol=lf + +crates/ruff/resources/test/fixtures/isort/line_ending_crlf.py text eol=crlf +crates/ruff/resources/test/fixtures/pycodestyle/W605_1.py text eol=crlf + +ruff.schema.json linguist-generated=true text=auto eol=lf diff --git a/crates/ruff/resources/test/fixtures/isort/line_ending_crlf.py b/crates/ruff/resources/test/fixtures/isort/line_ending_crlf.py index e949b26611..82aa39c405 100644 --- a/crates/ruff/resources/test/fixtures/isort/line_ending_crlf.py +++ b/crates/ruff/resources/test/fixtures/isort/line_ending_crlf.py @@ -1,2 +1,2 @@ -from long_module_name import member_one, member_two, member_three, member_four, member_five +from long_module_name import member_one, member_two, member_three, member_four, member_five diff --git a/crates/ruff/resources/test/fixtures/pycodestyle/W605_1.py b/crates/ruff/resources/test/fixtures/pycodestyle/W605_1.py index 3c7d905489..5322443e87 100644 --- a/crates/ruff/resources/test/fixtures/pycodestyle/W605_1.py +++ b/crates/ruff/resources/test/fixtures/pycodestyle/W605_1.py @@ -1,35 +1,35 @@ -#: W605:1:10 -regex = '\.png$' - -#: W605:2:1 -regex = ''' -\.png$ -''' - -#: W605:2:6 -f( - '\_' -) - -#: W605:4:6 -""" -multi-line -literal -with \_ somewhere -in the middle -""" - -#: Okay -regex = r'\.png$' -regex = '\\.png$' -regex = r''' -\.png$ -''' -regex = r''' -\\.png$ -''' -s = '\\' -regex = '\w' # noqa -regex = ''' -\w -''' # noqa +#: W605:1:10 +regex = '\.png$' + +#: W605:2:1 +regex = ''' +\.png$ +''' + +#: W605:2:6 +f( + '\_' +) + +#: W605:4:6 +""" +multi-line +literal +with \_ somewhere +in the middle +""" + +#: Okay +regex = r'\.png$' +regex = '\\.png$' +regex = r''' +\.png$ +''' +regex = r''' +\\.png$ +''' +s = '\\' +regex = '\w' # noqa +regex = ''' +\w +''' # noqa diff --git a/crates/ruff/src/assert_yaml_snapshot.rs b/crates/ruff/src/assert_yaml_snapshot.rs deleted file mode 100644 index ec2cf539e5..0000000000 --- a/crates/ruff/src/assert_yaml_snapshot.rs +++ /dev/null @@ -1,18 +0,0 @@ -/// Platform-independent snapshot assertion -#[macro_export] -macro_rules! assert_yaml_snapshot { - ( $($args: expr),+) => { - let line_sep = if cfg!(windows) { "\r\n" } else { "\n" }; - - // adjust snapshot file for platform - let mut settings = insta::Settings::clone_current(); - settings.add_redaction("[].fix.content", insta::dynamic_redaction(move |value, _path| { - insta::internals::Content::Seq( - value.as_str().unwrap().split(line_sep).map(|line| line.into()).collect() - ) - })); - settings.bind(|| { - insta::assert_yaml_snapshot!($($args),+); - }); - }; -} diff --git a/crates/ruff/src/lib.rs b/crates/ruff/src/lib.rs index 27ab4781e9..a1f93144a1 100644 --- a/crates/ruff/src/lib.rs +++ b/crates/ruff/src/lib.rs @@ -11,7 +11,6 @@ pub use rule_selector::RuleSelector; pub use rules::pycodestyle::rules::IOError; pub use violation::{AutofixKind, Availability as AutofixAvailability}; -mod assert_yaml_snapshot; mod ast; mod autofix; pub mod cache; diff --git a/crates/ruff/src/rules/eradicate/mod.rs b/crates/ruff/src/rules/eradicate/mod.rs index 3552d642d2..240bed4cbd 100644 --- a/crates/ruff/src/rules/eradicate/mod.rs +++ b/crates/ruff/src/rules/eradicate/mod.rs @@ -7,11 +7,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::CommentedOutCode, Path::new("ERA001.py"); "ERA001")] fn rules(rule_code: Rule, path: &Path) -> Result<()> { diff --git a/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap index e16c1020ac..06c113c756 100644 --- a/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/eradicate/mod.rs +source: crates/ruff/src/rules/eradicate/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 10 fix: - content: - - "" + content: "" location: row: 1 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 2 column: 22 fix: - content: - - "" + content: "" location: row: 2 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 3 column: 6 fix: - content: - - "" + content: "" location: row: 3 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 5 column: 13 fix: - content: - - "" + content: "" location: row: 5 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 12 column: 16 fix: - content: - - "" + content: "" location: row: 12 column: 0 diff --git a/crates/ruff/src/rules/flake8_2020/mod.rs b/crates/ruff/src/rules/flake8_2020/mod.rs index 45cbf91943..fce40f099b 100644 --- a/crates/ruff/src/rules/flake8_2020/mod.rs +++ b/crates/ruff/src/rules/flake8_2020/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::SysVersionSlice3Referenced, Path::new("YTT101.py"); "YTT101")] #[test_case(Rule::SysVersion2Referenced, Path::new("YTT102.py"); "YTT102")] diff --git a/crates/ruff/src/rules/flake8_annotations/mod.rs b/crates/ruff/src/rules/flake8_annotations/mod.rs index a6ebf9f3f5..384c82b1cf 100644 --- a/crates/ruff/src/rules/flake8_annotations/mod.rs +++ b/crates/ruff/src/rules/flake8_annotations/mod.rs @@ -9,8 +9,8 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_bandit/mod.rs b/crates/ruff/src/rules/flake8_bandit/mod.rs index 26d5f94744..d1168e6963 100644 --- a/crates/ruff/src/rules/flake8_bandit/mod.rs +++ b/crates/ruff/src/rules/flake8_bandit/mod.rs @@ -8,9 +8,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_blind_except/mod.rs b/crates/ruff/src/rules/flake8_blind_except/mod.rs index 28ddf48d12..4e89a909aa 100644 --- a/crates/ruff/src/rules/flake8_blind_except/mod.rs +++ b/crates/ruff/src/rules/flake8_blind_except/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::BlindExcept, Path::new("BLE.py"); "BLE001")] fn rules(rule_code: Rule, path: &Path) -> Result<()> { diff --git a/crates/ruff/src/rules/flake8_boolean_trap/mod.rs b/crates/ruff/src/rules/flake8_boolean_trap/mod.rs index 375e9b60e8..56f83175c3 100644 --- a/crates/ruff/src/rules/flake8_boolean_trap/mod.rs +++ b/crates/ruff/src/rules/flake8_boolean_trap/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::BooleanPositionalArgInFunctionDefinition, Path::new("FBT.py"); "FBT001")] #[test_case(Rule::BooleanDefaultValueInFunctionDefinition, Path::new("FBT.py"); "FBT002")] diff --git a/crates/ruff/src/rules/flake8_bugbear/mod.rs b/crates/ruff/src/rules/flake8_bugbear/mod.rs index b28073fd79..0765b834c1 100644 --- a/crates/ruff/src/rules/flake8_bugbear/mod.rs +++ b/crates/ruff/src/rules/flake8_bugbear/mod.rs @@ -7,9 +7,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B007_B007.py.snap index 7191407d82..b3463d5d22 100644 --- a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_bugbear/mod.rs +source: crates/ruff/src/rules/flake8_bugbear/mod.rs expression: diagnostics --- - kind: @@ -27,8 +27,7 @@ expression: diagnostics row: 18 column: 13 fix: - content: - - _k + content: _k location: row: 18 column: 12 @@ -61,8 +60,7 @@ expression: diagnostics row: 30 column: 13 fix: - content: - - _k + content: _k location: row: 30 column: 12 @@ -134,8 +132,7 @@ expression: diagnostics row: 52 column: 16 fix: - content: - - _bar + content: _bar location: row: 52 column: 13 @@ -168,8 +165,7 @@ expression: diagnostics row: 68 column: 16 fix: - content: - - _bar + content: _bar location: row: 68 column: 13 @@ -189,8 +185,7 @@ expression: diagnostics row: 77 column: 16 fix: - content: - - _bar + content: _bar location: row: 77 column: 13 diff --git a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index 80782d384e..648690c2e3 100644 --- a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_bugbear/mod.rs +source: crates/ruff/src/rules/flake8_bugbear/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 19 column: 19 fix: - content: - - foo.bar + content: foo.bar location: row: 19 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 20 column: 23 fix: - content: - - foo._123abc + content: foo._123abc location: row: 20 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 21 column: 26 fix: - content: - - foo.__123abc__ + content: foo.__123abc__ location: row: 21 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 22 column: 22 fix: - content: - - foo.abc123 + content: foo.abc123 location: row: 22 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 23 column: 23 fix: - content: - - foo.abc123 + content: foo.abc123 location: row: 23 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 24 column: 31 fix: - content: - - x.bar + content: x.bar location: row: 24 column: 14 @@ -119,8 +113,7 @@ expression: diagnostics row: 25 column: 20 fix: - content: - - x.bar + content: x.bar location: row: 25 column: 3 diff --git a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index 878859b69d..9c750f369c 100644 --- a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_bugbear/mod.rs +source: crates/ruff/src/rules/flake8_bugbear/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 40 column: 25 fix: - content: - - foo.bar = None + content: foo.bar = None location: row: 40 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 41 column: 29 fix: - content: - - foo._123abc = None + content: foo._123abc = None location: row: 41 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 42 column: 32 fix: - content: - - foo.__123abc__ = None + content: foo.__123abc__ = None location: row: 42 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 43 column: 28 fix: - content: - - foo.abc123 = None + content: foo.abc123 = None location: row: 43 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 44 column: 29 fix: - content: - - foo.abc123 = None + content: foo.abc123 = None location: row: 44 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 45 column: 30 fix: - content: - - foo.bar.baz = None + content: foo.bar.baz = None location: row: 45 column: 0 diff --git a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B011_B011.py.snap index 29801ba200..e6d1d8b5a7 100644 --- a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 8 column: 12 fix: - content: - - raise AssertionError() + content: raise AssertionError() location: row: 8 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 10 column: 12 fix: - content: - - "raise AssertionError(\"message\")" + content: "raise AssertionError(\"message\")" location: row: 10 column: 0 diff --git a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B013_B013.py.snap b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B013_B013.py.snap index 532ff9d9b2..b6af0ef89a 100644 --- a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B013_B013.py.snap +++ b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B013_B013.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_bugbear/mod.rs +source: crates/ruff/src/rules/flake8_bugbear/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 20 fix: - content: - - ValueError + content: ValueError location: row: 3 column: 7 diff --git a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B014_B014.py.snap b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B014_B014.py.snap index aea79f985b..161431f36d 100644 --- a/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B014_B014.py.snap +++ b/crates/ruff/src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B014_B014.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_bugbear/mod.rs +source: crates/ruff/src/rules/flake8_bugbear/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 17 column: 25 fix: - content: - - OSError + content: OSError location: row: 17 column: 7 @@ -33,8 +32,7 @@ expression: diagnostics row: 28 column: 25 fix: - content: - - MyError + content: MyError location: row: 28 column: 7 @@ -53,8 +51,7 @@ expression: diagnostics row: 49 column: 27 fix: - content: - - re.error + content: re.error location: row: 49 column: 7 diff --git a/crates/ruff/src/rules/flake8_builtins/mod.rs b/crates/ruff/src/rules/flake8_builtins/mod.rs index 5bb20d8a62..10ea3dd112 100644 --- a/crates/ruff/src/rules/flake8_builtins/mod.rs +++ b/crates/ruff/src/rules/flake8_builtins/mod.rs @@ -8,9 +8,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_commas/mod.rs b/crates/ruff/src/rules/flake8_commas/mod.rs index ca00f27ed7..06350675cc 100644 --- a/crates/ruff/src/rules/flake8_commas/mod.rs +++ b/crates/ruff/src/rules/flake8_commas/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Path::new("COM81.py"); "COM81")] fn rules(path: &Path) -> Result<()> { diff --git a/crates/ruff/src/rules/flake8_commas/snapshots/ruff__rules__flake8_commas__tests__COM81.py.snap b/crates/ruff/src/rules/flake8_commas/snapshots/ruff__rules__flake8_commas__tests__COM81.py.snap index 73fdd78cdd..7061b68d82 100644 --- a/crates/ruff/src/rules/flake8_commas/snapshots/ruff__rules__flake8_commas__tests__COM81.py.snap +++ b/crates/ruff/src/rules/flake8_commas/snapshots/ruff__rules__flake8_commas__tests__COM81.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_commas/mod.rs +source: crates/ruff/src/rules/flake8_commas/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 17 fix: - content: - - "," + content: "," location: row: 4 column: 17 @@ -29,8 +28,7 @@ expression: diagnostics row: 10 column: 5 fix: - content: - - "," + content: "," location: row: 10 column: 5 @@ -47,8 +45,7 @@ expression: diagnostics row: 16 column: 5 fix: - content: - - "," + content: "," location: row: 16 column: 5 @@ -65,8 +62,7 @@ expression: diagnostics row: 23 column: 5 fix: - content: - - "," + content: "," location: row: 23 column: 5 @@ -153,8 +149,7 @@ expression: diagnostics row: 70 column: 7 fix: - content: - - "," + content: "," location: row: 70 column: 7 @@ -171,8 +166,7 @@ expression: diagnostics row: 78 column: 7 fix: - content: - - "," + content: "," location: row: 78 column: 7 @@ -189,8 +183,7 @@ expression: diagnostics row: 86 column: 7 fix: - content: - - "," + content: "," location: row: 86 column: 7 @@ -207,8 +200,7 @@ expression: diagnostics row: 152 column: 5 fix: - content: - - "," + content: "," location: row: 152 column: 5 @@ -225,8 +217,7 @@ expression: diagnostics row: 158 column: 10 fix: - content: - - "," + content: "," location: row: 158 column: 10 @@ -243,8 +234,7 @@ expression: diagnostics row: 293 column: 14 fix: - content: - - "," + content: "," location: row: 293 column: 14 @@ -261,8 +251,7 @@ expression: diagnostics row: 304 column: 13 fix: - content: - - "," + content: "," location: row: 304 column: 13 @@ -279,8 +268,7 @@ expression: diagnostics row: 310 column: 13 fix: - content: - - "," + content: "," location: row: 310 column: 13 @@ -297,8 +285,7 @@ expression: diagnostics row: 316 column: 9 fix: - content: - - "," + content: "," location: row: 316 column: 9 @@ -315,8 +302,7 @@ expression: diagnostics row: 322 column: 14 fix: - content: - - "," + content: "," location: row: 322 column: 14 @@ -333,8 +319,7 @@ expression: diagnostics row: 368 column: 14 fix: - content: - - "," + content: "," location: row: 368 column: 14 @@ -351,8 +336,7 @@ expression: diagnostics row: 375 column: 14 fix: - content: - - "," + content: "," location: row: 375 column: 14 @@ -369,8 +353,7 @@ expression: diagnostics row: 404 column: 14 fix: - content: - - "," + content: "," location: row: 404 column: 14 @@ -387,8 +370,7 @@ expression: diagnostics row: 432 column: 14 fix: - content: - - "," + content: "," location: row: 432 column: 14 @@ -405,8 +387,7 @@ expression: diagnostics row: 485 column: 21 fix: - content: - - "" + content: "" location: row: 485 column: 20 @@ -423,8 +404,7 @@ expression: diagnostics row: 487 column: 13 fix: - content: - - "" + content: "" location: row: 487 column: 12 @@ -441,8 +421,7 @@ expression: diagnostics row: 489 column: 18 fix: - content: - - "" + content: "" location: row: 489 column: 17 @@ -459,8 +438,7 @@ expression: diagnostics row: 494 column: 6 fix: - content: - - "" + content: "" location: row: 494 column: 5 @@ -477,8 +455,7 @@ expression: diagnostics row: 496 column: 21 fix: - content: - - "" + content: "" location: row: 496 column: 20 @@ -495,8 +472,7 @@ expression: diagnostics row: 498 column: 13 fix: - content: - - "" + content: "" location: row: 498 column: 12 @@ -513,8 +489,7 @@ expression: diagnostics row: 500 column: 18 fix: - content: - - "" + content: "" location: row: 500 column: 17 @@ -531,8 +506,7 @@ expression: diagnostics row: 505 column: 6 fix: - content: - - "" + content: "" location: row: 505 column: 5 @@ -549,8 +523,7 @@ expression: diagnostics row: 511 column: 10 fix: - content: - - "" + content: "" location: row: 511 column: 9 @@ -567,8 +540,7 @@ expression: diagnostics row: 513 column: 9 fix: - content: - - "" + content: "" location: row: 513 column: 8 @@ -585,8 +557,7 @@ expression: diagnostics row: 519 column: 12 fix: - content: - - "," + content: "," location: row: 519 column: 12 @@ -603,8 +574,7 @@ expression: diagnostics row: 526 column: 9 fix: - content: - - "," + content: "," location: row: 526 column: 9 @@ -621,8 +591,7 @@ expression: diagnostics row: 534 column: 15 fix: - content: - - "," + content: "," location: row: 534 column: 15 @@ -639,8 +608,7 @@ expression: diagnostics row: 541 column: 12 fix: - content: - - "," + content: "," location: row: 541 column: 12 @@ -657,8 +625,7 @@ expression: diagnostics row: 547 column: 23 fix: - content: - - "," + content: "," location: row: 547 column: 23 @@ -675,8 +642,7 @@ expression: diagnostics row: 554 column: 14 fix: - content: - - "," + content: "," location: row: 554 column: 14 @@ -693,8 +659,7 @@ expression: diagnostics row: 561 column: 12 fix: - content: - - "," + content: "," location: row: 561 column: 12 @@ -711,8 +676,7 @@ expression: diagnostics row: 565 column: 12 fix: - content: - - "," + content: "," location: row: 565 column: 12 @@ -729,8 +693,7 @@ expression: diagnostics row: 573 column: 9 fix: - content: - - "," + content: "," location: row: 573 column: 9 @@ -747,8 +710,7 @@ expression: diagnostics row: 577 column: 9 fix: - content: - - "," + content: "," location: row: 577 column: 9 @@ -765,8 +727,7 @@ expression: diagnostics row: 583 column: 9 fix: - content: - - "," + content: "," location: row: 583 column: 9 @@ -783,8 +744,7 @@ expression: diagnostics row: 590 column: 12 fix: - content: - - "," + content: "," location: row: 590 column: 12 @@ -801,8 +761,7 @@ expression: diagnostics row: 598 column: 14 fix: - content: - - "," + content: "," location: row: 598 column: 14 @@ -819,8 +778,7 @@ expression: diagnostics row: 627 column: 19 fix: - content: - - "," + content: "," location: row: 627 column: 19 diff --git a/crates/ruff/src/rules/flake8_comprehensions/mod.rs b/crates/ruff/src/rules/flake8_comprehensions/mod.rs index 6f86ee9d9b..718a44b53d 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/mod.rs +++ b/crates/ruff/src/rules/flake8_comprehensions/mod.rs @@ -8,9 +8,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; @@ -31,7 +31,6 @@ mod tests { #[test_case(Rule::UnnecessarySubscriptReversal, Path::new("C415.py"); "C415")] #[test_case(Rule::UnnecessaryComprehension, Path::new("C416.py"); "C416")] #[test_case(Rule::UnnecessaryMap, Path::new("C417.py"); "C417")] - fn rules(rule_code: Rule, path: &Path) -> Result<()> { let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy()); let diagnostics = test_path( diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C400_C400.py.snap index d32a851f51..37a0a8864b 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 29 fix: - content: - - "[x for x in range(3)]" + content: "[x for x in range(3)]" location: row: 1 column: 4 @@ -29,10 +28,7 @@ expression: diagnostics row: 4 column: 1 fix: - content: - - "[" - - " x for x in range(3)" - - "]" + content: "[\n x for x in range(3)\n]" location: row: 2 column: 4 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C401_C401.py.snap index 2eb34a4d58..0c9910e087 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 28 fix: - content: - - "{x for x in range(3)}" + content: "{x for x in range(3)}" location: row: 1 column: 4 @@ -29,10 +28,7 @@ expression: diagnostics row: 4 column: 1 fix: - content: - - "{" - - " x for x in range(3)" - - "}" + content: "{\n x for x in range(3)\n}" location: row: 2 column: 4 @@ -49,8 +45,7 @@ expression: diagnostics row: 5 column: 48 fix: - content: - - " {a if a < 6 else 0 for a in range(3)} " + content: " {a if a < 6 else 0 for a in range(3)} " location: row: 5 column: 7 @@ -67,8 +62,7 @@ expression: diagnostics row: 6 column: 57 fix: - content: - - "{a if a < 6 else 0 for a in range(3)}" + content: "{a if a < 6 else 0 for a in range(3)}" location: row: 6 column: 16 @@ -85,8 +79,7 @@ expression: diagnostics row: 7 column: 39 fix: - content: - - " {a for a in range(3)} " + content: " {a for a in range(3)} " location: row: 7 column: 15 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C402_C402.py.snap index af2729e496..2a73071d71 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 30 fix: - content: - - "{x: x for x in range(3)}" + content: "{x: x for x in range(3)}" location: row: 1 column: 0 @@ -29,10 +28,7 @@ expression: diagnostics row: 4 column: 1 fix: - content: - - "{" - - " x: x for x in range(3)" - - "}" + content: "{\n x: x for x in range(3)\n}" location: row: 2 column: 0 @@ -49,8 +45,7 @@ expression: diagnostics row: 6 column: 37 fix: - content: - - " {x: x for x in range(3)} " + content: " {x: x for x in range(3)} " location: row: 6 column: 7 @@ -67,8 +62,7 @@ expression: diagnostics row: 7 column: 45 fix: - content: - - " {x: x for x in range(3)} " + content: " {x: x for x in range(3)} " location: row: 7 column: 15 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C403_C403.py.snap index 86b4a0af56..4ad110879b 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 30 fix: - content: - - "{x for x in range(3)}" + content: "{x for x in range(3)}" location: row: 1 column: 4 @@ -29,10 +28,7 @@ expression: diagnostics row: 4 column: 1 fix: - content: - - "{" - - " x for x in range(3)" - - "}" + content: "{\n x for x in range(3)\n}" location: row: 2 column: 4 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C404_C404.py.snap index 8d09ce9325..6664a36872 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 32 fix: - content: - - "{i: i for i in range(3)}" + content: "{i: i for i in range(3)}" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C405_C405.py.snap index d71178e445..fee51e7eb0 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 11 fix: - content: - - "{1, 2}" + content: "{1, 2}" location: row: 1 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 11 fix: - content: - - "{1, 2}" + content: "{1, 2}" location: row: 2 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 7 fix: - content: - - set() + content: set() location: row: 3 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 4 column: 7 fix: - content: - - set() + content: set() location: row: 4 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 6 column: 9 fix: - content: - - "{1}" + content: "{1}" location: row: 6 column: 0 @@ -107,10 +102,7 @@ expression: diagnostics row: 9 column: 2 fix: - content: - - "{" - - " 1," - - "}" + content: "{\n 1,\n}" location: row: 7 column: 0 @@ -128,10 +120,7 @@ expression: diagnostics row: 12 column: 2 fix: - content: - - "{" - - " 1," - - "}" + content: "{\n 1,\n}" location: row: 10 column: 0 @@ -149,8 +138,7 @@ expression: diagnostics row: 15 column: 1 fix: - content: - - "{1}" + content: "{1}" location: row: 13 column: 0 @@ -168,8 +156,7 @@ expression: diagnostics row: 18 column: 1 fix: - content: - - "{1,}" + content: "{1,}" location: row: 16 column: 0 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C406_C406.py.snap index 05cead26a8..5f11c835fa 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 19 fix: - content: - - "{1: 2}" + content: "{1: 2}" location: row: 1 column: 5 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 20 fix: - content: - - "{1: 2,}" + content: "{1: 2,}" location: row: 2 column: 5 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 13 fix: - content: - - "{}" + content: "{}" location: row: 3 column: 5 @@ -69,8 +66,7 @@ expression: diagnostics row: 4 column: 13 fix: - content: - - "{}" + content: "{}" location: row: 4 column: 5 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py.snap index a39fc185f8..d433c7ef4c 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 11 fix: - content: - - () + content: () location: row: 1 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 10 fix: - content: - - "[]" + content: "[]" location: row: 2 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 11 fix: - content: - - "{}" + content: "{}" location: row: 3 column: 5 @@ -69,8 +66,7 @@ expression: diagnostics row: 4 column: 14 fix: - content: - - "{\"a\": 1}" + content: "{\"a\": 1}" location: row: 4 column: 5 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index 867bd54bd3..825be173f4 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 11 fix: - content: - - () + content: () location: row: 1 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 10 fix: - content: - - "[]" + content: "[]" location: row: 2 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 11 fix: - content: - - "{}" + content: "{}" location: row: 3 column: 5 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C409_C409.py.snap index 929f706124..aed3ca187c 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 14 fix: - content: - - () + content: () location: row: 1 column: 5 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 18 fix: - content: - - "(1, 2)" + content: "(1, 2)" location: row: 2 column: 5 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 18 fix: - content: - - "(1, 2)" + content: "(1, 2)" location: row: 3 column: 5 @@ -69,11 +66,7 @@ expression: diagnostics row: 7 column: 2 fix: - content: - - ( - - " 1," - - " 2" - - ) + content: "(\n 1,\n 2\n)" location: row: 4 column: 5 @@ -91,8 +84,7 @@ expression: diagnostics row: 10 column: 1 fix: - content: - - "(1, 2)" + content: "(1, 2)" location: row: 8 column: 5 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C410_C410.py.snap index 3a2c4a1016..89693b036b 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 17 fix: - content: - - "[1, 2]" + content: "[1, 2]" location: row: 1 column: 5 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 17 fix: - content: - - "[1, 2]" + content: "[1, 2]" location: row: 2 column: 5 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 13 fix: - content: - - "[]" + content: "[]" location: row: 3 column: 5 @@ -69,8 +66,7 @@ expression: diagnostics row: 4 column: 13 fix: - content: - - "[]" + content: "[]" location: row: 4 column: 5 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C411_C411.py.snap index efd5390a29..1b1d0fe136 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 20 fix: - content: - - "[i for i in x]" + content: "[i for i in x]" location: row: 2 column: 0 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C413_C413.py.snap index 4b4d5b978e..8809cf5713 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 15 fix: - content: - - sorted(x) + content: sorted(x) location: row: 3 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 19 fix: - content: - - "sorted(x, reverse=True)" + content: "sorted(x, reverse=True)" location: row: 4 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 5 column: 36 fix: - content: - - "sorted(x, key=lambda e: e, reverse=True)" + content: "sorted(x, key=lambda e: e, reverse=True)" location: row: 5 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 6 column: 33 fix: - content: - - "sorted(x, reverse=False)" + content: "sorted(x, reverse=False)" location: row: 6 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 7 column: 50 fix: - content: - - "sorted(x, key=lambda e: e, reverse=False)" + content: "sorted(x, key=lambda e: e, reverse=False)" location: row: 7 column: 0 @@ -107,8 +102,7 @@ expression: diagnostics row: 8 column: 50 fix: - content: - - "sorted(x, reverse=False, key=lambda e: e)" + content: "sorted(x, reverse=False, key=lambda e: e)" location: row: 8 column: 0 @@ -126,8 +120,7 @@ expression: diagnostics row: 9 column: 34 fix: - content: - - "sorted(x, reverse=True)" + content: "sorted(x, reverse=True)" location: row: 9 column: 0 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C414_C414.py.snap index d34e57f601..77eee25598 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 2 column: 13 fix: - content: - - list(x) + content: list(x) location: row: 2 column: 0 @@ -33,8 +32,7 @@ expression: diagnostics row: 3 column: 14 fix: - content: - - list(x) + content: list(x) location: row: 3 column: 0 @@ -53,8 +51,7 @@ expression: diagnostics row: 4 column: 14 fix: - content: - - tuple(x) + content: tuple(x) location: row: 4 column: 0 @@ -73,8 +70,7 @@ expression: diagnostics row: 5 column: 15 fix: - content: - - tuple(x) + content: tuple(x) location: row: 5 column: 0 @@ -93,8 +89,7 @@ expression: diagnostics row: 6 column: 11 fix: - content: - - set(x) + content: set(x) location: row: 6 column: 0 @@ -113,8 +108,7 @@ expression: diagnostics row: 7 column: 12 fix: - content: - - set(x) + content: set(x) location: row: 7 column: 0 @@ -133,8 +127,7 @@ expression: diagnostics row: 8 column: 13 fix: - content: - - set(x) + content: set(x) location: row: 8 column: 0 @@ -153,8 +146,7 @@ expression: diagnostics row: 9 column: 14 fix: - content: - - set(x) + content: set(x) location: row: 9 column: 0 @@ -173,8 +165,7 @@ expression: diagnostics row: 10 column: 16 fix: - content: - - set(x) + content: set(x) location: row: 10 column: 0 @@ -193,8 +184,7 @@ expression: diagnostics row: 11 column: 15 fix: - content: - - sorted(x) + content: sorted(x) location: row: 11 column: 0 @@ -213,8 +203,7 @@ expression: diagnostics row: 12 column: 16 fix: - content: - - sorted(x) + content: sorted(x) location: row: 12 column: 0 @@ -233,8 +222,7 @@ expression: diagnostics row: 13 column: 17 fix: - content: - - sorted(x) + content: sorted(x) location: row: 13 column: 0 @@ -253,8 +241,7 @@ expression: diagnostics row: 14 column: 19 fix: - content: - - sorted(x) + content: sorted(x) location: row: 14 column: 0 @@ -273,11 +260,7 @@ expression: diagnostics row: 20 column: 1 fix: - content: - - tuple( - - " [x, 3, \"hell\"\\" - - " \"o\"]" - - " )" + content: "tuple(\n [x, 3, \"hell\"\\\n \"o\"]\n )" location: row: 15 column: 0 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C416_C416.py.snap index 01453185a7..235cd61d04 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_comprehensions/mod.rs +source: crates/ruff/src/rules/flake8_comprehensions/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 14 fix: - content: - - list(x) + content: list(x) location: row: 2 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 3 column: 14 fix: - content: - - set(x) + content: set(x) location: row: 3 column: 0 diff --git a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C417_C417.py.snap index 86a38f45b2..2db00e3057 100644 --- a/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff/src/rules/flake8_comprehensions/snapshots/ruff__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 26 fix: - content: - - (x + 1 for x in nums) + content: (x + 1 for x in nums) location: row: 3 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 27 fix: - content: - - (str(x) for x in nums) + content: (str(x) for x in nums) location: row: 4 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 5 column: 32 fix: - content: - - "[x * 2 for x in nums]" + content: "[x * 2 for x in nums]" location: row: 5 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 6 column: 36 fix: - content: - - "{x % 2 == 0 for x in nums}" + content: "{x % 2 == 0 for x in nums}" location: row: 6 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 7 column: 36 fix: - content: - - "{v: v**2 for v in nums}" + content: "{v: v**2 for v in nums}" location: row: 7 column: 0 @@ -107,8 +102,7 @@ expression: diagnostics row: 8 column: 26 fix: - content: - - "(\"const\" for _ in nums)" + content: "(\"const\" for _ in nums)" location: row: 8 column: 0 @@ -126,8 +120,7 @@ expression: diagnostics row: 9 column: 24 fix: - content: - - (3.0 for _ in nums) + content: (3.0 for _ in nums) location: row: 9 column: 0 @@ -145,8 +138,7 @@ expression: diagnostics row: 10 column: 63 fix: - content: - - "(x in nums and \"1\" or \"0\" for x in range(123))" + content: "(x in nums and \"1\" or \"0\" for x in range(123))" location: row: 10 column: 12 @@ -164,8 +156,7 @@ expression: diagnostics row: 11 column: 44 fix: - content: - - "(isinstance(v, dict) for v in nums)" + content: "(isinstance(v, dict) for v in nums)" location: row: 11 column: 4 @@ -183,8 +174,7 @@ expression: diagnostics row: 12 column: 35 fix: - content: - - (v for v in nums) + content: (v for v in nums) location: row: 12 column: 13 @@ -202,8 +192,7 @@ expression: diagnostics row: 15 column: 43 fix: - content: - - " {x % 2 == 0 for x in nums} " + content: " {x % 2 == 0 for x in nums} " location: row: 15 column: 7 @@ -221,8 +210,7 @@ expression: diagnostics row: 16 column: 43 fix: - content: - - " {v: v**2 for v in nums} " + content: " {v: v**2 for v in nums} " location: row: 16 column: 7 diff --git a/crates/ruff/src/rules/flake8_datetimez/mod.rs b/crates/ruff/src/rules/flake8_datetimez/mod.rs index 96d7ca268a..764cbe7b29 100644 --- a/crates/ruff/src/rules/flake8_datetimez/mod.rs +++ b/crates/ruff/src/rules/flake8_datetimez/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::CallDatetimeWithoutTzinfo, Path::new("DTZ001.py"); "DTZ001")] #[test_case(Rule::CallDatetimeToday, Path::new("DTZ002.py"); "DTZ002")] diff --git a/crates/ruff/src/rules/flake8_debugger/mod.rs b/crates/ruff/src/rules/flake8_debugger/mod.rs index 16d67f338c..14832cab66 100644 --- a/crates/ruff/src/rules/flake8_debugger/mod.rs +++ b/crates/ruff/src/rules/flake8_debugger/mod.rs @@ -7,11 +7,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::Debugger, Path::new("T100.py"); "T100")] fn rules(rule_code: Rule, path: &Path) -> Result<()> { diff --git a/crates/ruff/src/rules/flake8_django/mod.rs b/crates/ruff/src/rules/flake8_django/mod.rs index 0fce19b4ab..b9840e6652 100644 --- a/crates/ruff/src/rules/flake8_django/mod.rs +++ b/crates/ruff/src/rules/flake8_django/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::NullableModelStringField, Path::new("DJ001.py"); "DJ001")] #[test_case(Rule::ModelWithoutDunderStr, Path::new("DJ008.py"); "DJ008")] diff --git a/crates/ruff/src/rules/flake8_errmsg/mod.rs b/crates/ruff/src/rules/flake8_errmsg/mod.rs index 562b904a75..dbea04a300 100644 --- a/crates/ruff/src/rules/flake8_errmsg/mod.rs +++ b/crates/ruff/src/rules/flake8_errmsg/mod.rs @@ -7,10 +7,11 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test] fn defaults() -> Result<()> { diff --git a/crates/ruff/src/rules/flake8_executable/mod.rs b/crates/ruff/src/rules/flake8_executable/mod.rs index bf3b40b2c6..0c2cd88ddb 100644 --- a/crates/ruff/src/rules/flake8_executable/mod.rs +++ b/crates/ruff/src/rules/flake8_executable/mod.rs @@ -8,11 +8,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Path::new("EXE001_1.py"); "EXE001_1")] #[test_case(Path::new("EXE001_2.py"); "EXE001_2")] diff --git a/crates/ruff/src/rules/flake8_executable/snapshots/ruff__rules__flake8_executable__tests__EXE004_1.py.snap b/crates/ruff/src/rules/flake8_executable/snapshots/ruff__rules__flake8_executable__tests__EXE004_1.py.snap index 21a9c7951a..fdf671dd78 100644 --- a/crates/ruff/src/rules/flake8_executable/snapshots/ruff__rules__flake8_executable__tests__EXE004_1.py.snap +++ b/crates/ruff/src/rules/flake8_executable/snapshots/ruff__rules__flake8_executable__tests__EXE004_1.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_executable/mod.rs +source: crates/ruff/src/rules/flake8_executable/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 4 fix: - content: - - "" + content: "" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/flake8_implicit_str_concat/mod.rs b/crates/ruff/src/rules/flake8_implicit_str_concat/mod.rs index 644b94e7c2..8bb38e3544 100644 --- a/crates/ruff/src/rules/flake8_implicit_str_concat/mod.rs +++ b/crates/ruff/src/rules/flake8_implicit_str_concat/mod.rs @@ -7,11 +7,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::SingleLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC001")] #[test_case(Rule::MultiLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC002")] diff --git a/crates/ruff/src/rules/flake8_import_conventions/mod.rs b/crates/ruff/src/rules/flake8_import_conventions/mod.rs index 9c0ad0fdfa..a3585a7530 100644 --- a/crates/ruff/src/rules/flake8_import_conventions/mod.rs +++ b/crates/ruff/src/rules/flake8_import_conventions/mod.rs @@ -7,9 +7,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use rustc_hash::FxHashMap; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_no_pep420/mod.rs b/crates/ruff/src/rules/flake8_no_pep420/mod.rs index d38c5d2262..358354e391 100644 --- a/crates/ruff/src/rules/flake8_no_pep420/mod.rs +++ b/crates/ruff/src/rules/flake8_no_pep420/mod.rs @@ -6,9 +6,9 @@ mod tests { use std::path::{Path, PathBuf}; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::{test_path, test_resource_path}; diff --git a/crates/ruff/src/rules/flake8_pie/mod.rs b/crates/ruff/src/rules/flake8_pie/mod.rs index 501c0d4774..21040fd1f0 100644 --- a/crates/ruff/src/rules/flake8_pie/mod.rs +++ b/crates/ruff/src/rules/flake8_pie/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::DupeClassFieldDefinitions, Path::new("PIE794.py"); "PIE794")] #[test_case(Rule::UnnecessaryDictKwargs, Path::new("PIE804.py"); "PIE804")] diff --git a/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE790_PIE790.py.snap b/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE790_PIE790.py.snap index 4c0b5d866a..f2268bd3f6 100644 --- a/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE790_PIE790.py.snap +++ b/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE790_PIE790.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 8 fix: - content: - - "" + content: "" location: row: 4 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - "" + content: "" location: row: 9 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 14 column: 8 fix: - content: - - "" + content: "" location: row: 14 column: 4 @@ -65,8 +62,7 @@ expression: diagnostics row: 21 column: 8 fix: - content: - - "" + content: "" location: row: 21 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 28 column: 8 fix: - content: - - "" + content: "" location: row: 28 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 35 column: 8 fix: - content: - - "" + content: "" location: row: 35 column: 0 @@ -119,8 +113,7 @@ expression: diagnostics row: 42 column: 8 fix: - content: - - "" + content: "" location: row: 42 column: 0 @@ -137,8 +130,7 @@ expression: diagnostics row: 50 column: 8 fix: - content: - - "" + content: "" location: row: 50 column: 0 @@ -155,8 +147,7 @@ expression: diagnostics row: 58 column: 8 fix: - content: - - "" + content: "" location: row: 58 column: 0 @@ -173,8 +164,7 @@ expression: diagnostics row: 65 column: 8 fix: - content: - - "" + content: "" location: row: 65 column: 0 @@ -191,8 +181,7 @@ expression: diagnostics row: 74 column: 8 fix: - content: - - "" + content: "" location: row: 74 column: 0 @@ -209,8 +198,7 @@ expression: diagnostics row: 79 column: 8 fix: - content: - - "" + content: "" location: row: 79 column: 0 @@ -227,8 +215,7 @@ expression: diagnostics row: 83 column: 8 fix: - content: - - "" + content: "" location: row: 83 column: 0 @@ -245,8 +232,7 @@ expression: diagnostics row: 87 column: 8 fix: - content: - - "" + content: "" location: row: 87 column: 0 @@ -263,8 +249,7 @@ expression: diagnostics row: 92 column: 8 fix: - content: - - "" + content: "" location: row: 92 column: 0 @@ -281,8 +266,7 @@ expression: diagnostics row: 96 column: 8 fix: - content: - - "" + content: "" location: row: 96 column: 0 @@ -299,8 +283,7 @@ expression: diagnostics row: 101 column: 8 fix: - content: - - "" + content: "" location: row: 101 column: 4 diff --git a/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE794_PIE794.py.snap index 5b95d99bc7..bab8b64b2e 100644 --- a/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pie/mod.rs +source: crates/ruff/src/rules/flake8_pie/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 24 fix: - content: - - "" + content: "" location: row: 4 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 13 column: 24 fix: - content: - - "" + content: "" location: row: 13 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 23 column: 23 fix: - content: - - "" + content: "" location: row: 23 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 40 column: 23 fix: - content: - - "" + content: "" location: row: 40 column: 0 diff --git a/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE807_PIE807.py.snap b/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE807_PIE807.py.snap index f7a2c2b5d0..f573980234 100644 --- a/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE807_PIE807.py.snap +++ b/crates/ruff/src/rules/flake8_pie/snapshots/ruff__rules__flake8_pie__tests__PIE807_PIE807.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pie/mod.rs +source: crates/ruff/src/rules/flake8_pie/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 3 column: 53 fix: - content: - - list + content: list location: row: 3 column: 43 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 45 fix: - content: - - list + content: list location: row: 7 column: 35 @@ -47,8 +45,7 @@ expression: diagnostics row: 11 column: 37 fix: - content: - - list + content: list location: row: 11 column: 27 diff --git a/crates/ruff/src/rules/flake8_print/mod.rs b/crates/ruff/src/rules/flake8_print/mod.rs index e2094d7189..b1a620708c 100644 --- a/crates/ruff/src/rules/flake8_print/mod.rs +++ b/crates/ruff/src/rules/flake8_print/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::PrintFound, Path::new("T201.py"); "T201")] #[test_case(Rule::PPrintFound, Path::new("T203.py"); "T203")] diff --git a/crates/ruff/src/rules/flake8_pyi/mod.rs b/crates/ruff/src/rules/flake8_pyi/mod.rs index 6c4edf4f16..b46ad749e6 100644 --- a/crates/ruff/src/rules/flake8_pyi/mod.rs +++ b/crates/ruff/src/rules/flake8_pyi/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::PrefixTypeParams, Path::new("PYI001.pyi"))] #[test_case(Rule::PrefixTypeParams, Path::new("PYI001.py"))] diff --git a/crates/ruff/src/rules/flake8_pytest_style/mod.rs b/crates/ruff/src/rules/flake8_pytest_style/mod.rs index 11d36de85a..48f4ffc3a0 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/mod.rs +++ b/crates/ruff/src/rules/flake8_pytest_style/mod.rs @@ -8,13 +8,14 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use super::settings::Settings; use super::types; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::IncorrectFixtureParenthesesStyle, Path::new("PT001.py"), Settings::default(), "PT001_default"; "PT001_0")] #[test_case( diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_default.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_default.snap index 450a3ad116..e00d4c9ac7 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_default.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_default.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 9 column: 15 fix: - content: - - () + content: () location: row: 9 column: 15 @@ -33,8 +32,7 @@ expression: diagnostics row: 34 column: 8 fix: - content: - - () + content: () location: row: 34 column: 8 @@ -53,8 +51,7 @@ expression: diagnostics row: 59 column: 8 fix: - content: - - () + content: () location: row: 59 column: 8 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap index f13d6b66bb..8e342ed9e0 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 14 column: 17 fix: - content: - - "" + content: "" location: row: 14 column: 15 @@ -33,8 +32,7 @@ expression: diagnostics row: 26 column: 1 fix: - content: - - "" + content: "" location: row: 24 column: 15 @@ -53,8 +51,7 @@ expression: diagnostics row: 39 column: 10 fix: - content: - - "" + content: "" location: row: 39 column: 8 @@ -73,8 +70,7 @@ expression: diagnostics row: 51 column: 1 fix: - content: - - "" + content: "" location: row: 49 column: 8 @@ -93,8 +89,7 @@ expression: diagnostics row: 64 column: 10 fix: - content: - - "" + content: "" location: row: 64 column: 8 @@ -113,8 +108,7 @@ expression: diagnostics row: 76 column: 1 fix: - content: - - "" + content: "" location: row: 74 column: 8 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT003.snap index 74ae7643fa..be469688c5 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT003.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 14 column: 32 fix: - content: - - "" + content: "" location: row: 14 column: 16 @@ -29,8 +28,7 @@ expression: diagnostics row: 19 column: 32 fix: - content: - - "" + content: "" location: row: 19 column: 16 @@ -47,8 +45,7 @@ expression: diagnostics row: 24 column: 51 fix: - content: - - "" + content: "" location: row: 24 column: 33 @@ -65,8 +62,7 @@ expression: diagnostics row: 29 column: 51 fix: - content: - - "" + content: "" location: row: 29 column: 35 @@ -83,8 +79,7 @@ expression: diagnostics row: 37 column: 46 fix: - content: - - "" + content: "" location: row: 37 column: 28 @@ -101,8 +96,7 @@ expression: diagnostics row: 43 column: 20 fix: - content: - - "" + content: "" location: row: 43 column: 4 @@ -119,8 +113,7 @@ expression: diagnostics row: 52 column: 20 fix: - content: - - "" + content: "" location: row: 51 column: 21 @@ -137,8 +130,7 @@ expression: diagnostics row: 67 column: 18 fix: - content: - - "" + content: "" location: row: 66 column: 4 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_csv.snap index d74144aa2e..6c31c725b3 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 24 column: 45 fix: - content: - - "\"param1,param2\"" + content: "\"param1,param2\"" location: row: 24 column: 25 @@ -31,8 +30,7 @@ expression: diagnostics row: 29 column: 36 fix: - content: - - "\"param1\"" + content: "\"param1\"" location: row: 29 column: 25 @@ -50,8 +48,7 @@ expression: diagnostics row: 34 column: 45 fix: - content: - - "\"param1,param2\"" + content: "\"param1,param2\"" location: row: 34 column: 25 @@ -69,8 +66,7 @@ expression: diagnostics row: 39 column: 35 fix: - content: - - "\"param1\"" + content: "\"param1\"" location: row: 39 column: 25 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_default.snap index de05fd36e8..4d14964a77 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_default.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 9 column: 40 fix: - content: - - "(\"param1\", \"param2\")" + content: "(\"param1\", \"param2\")" location: row: 9 column: 25 @@ -31,8 +30,7 @@ expression: diagnostics row: 14 column: 56 fix: - content: - - "(\"param1\", \"param2\")" + content: "(\"param1\", \"param2\")" location: row: 14 column: 25 @@ -50,8 +48,7 @@ expression: diagnostics row: 19 column: 40 fix: - content: - - "(\"param1\", \"param2\")" + content: "(\"param1\", \"param2\")" location: row: 19 column: 25 @@ -69,8 +66,7 @@ expression: diagnostics row: 29 column: 36 fix: - content: - - "\"param1\"" + content: "\"param1\"" location: row: 29 column: 25 @@ -88,8 +84,7 @@ expression: diagnostics row: 34 column: 45 fix: - content: - - "(\"param1\", \"param2\")" + content: "(\"param1\", \"param2\")" location: row: 34 column: 25 @@ -107,8 +102,7 @@ expression: diagnostics row: 39 column: 35 fix: - content: - - "\"param1\"" + content: "\"param1\"" location: row: 39 column: 25 @@ -126,8 +120,7 @@ expression: diagnostics row: 44 column: 50 fix: - content: - - "(some_expr, another_expr)" + content: "(some_expr, another_expr)" location: row: 44 column: 25 @@ -145,8 +138,7 @@ expression: diagnostics row: 49 column: 46 fix: - content: - - "(some_expr, \"param2\")" + content: "(some_expr, \"param2\")" location: row: 49 column: 25 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_list.snap index 409b199cba..df945edded 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT006_list.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 9 column: 40 fix: - content: - - "[\"param1\", \"param2\"]" + content: "[\"param1\", \"param2\"]" location: row: 9 column: 25 @@ -31,8 +30,7 @@ expression: diagnostics row: 14 column: 56 fix: - content: - - "[\"param1\", \"param2\"]" + content: "[\"param1\", \"param2\"]" location: row: 14 column: 25 @@ -50,8 +48,7 @@ expression: diagnostics row: 19 column: 40 fix: - content: - - "[\"param1\", \"param2\"]" + content: "[\"param1\", \"param2\"]" location: row: 19 column: 25 @@ -69,8 +66,7 @@ expression: diagnostics row: 24 column: 45 fix: - content: - - "[\"param1\", \"param2\"]" + content: "[\"param1\", \"param2\"]" location: row: 24 column: 25 @@ -88,8 +84,7 @@ expression: diagnostics row: 29 column: 36 fix: - content: - - "\"param1\"" + content: "\"param1\"" location: row: 29 column: 25 @@ -107,8 +102,7 @@ expression: diagnostics row: 39 column: 35 fix: - content: - - "\"param1\"" + content: "\"param1\"" location: row: 39 column: 25 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT009.snap index 70357b21a4..9389e991fa 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT009.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 11 column: 23 fix: - content: - - assert expr + content: assert expr location: row: 11 column: 8 @@ -33,8 +32,7 @@ expression: diagnostics row: 12 column: 23 fix: - content: - - assert expr + content: assert expr location: row: 12 column: 8 @@ -53,8 +51,7 @@ expression: diagnostics row: 13 column: 23 fix: - content: - - "assert expr, msg" + content: "assert expr, msg" location: row: 13 column: 8 @@ -73,8 +70,7 @@ expression: diagnostics row: 14 column: 23 fix: - content: - - "assert expr, msg" + content: "assert expr, msg" location: row: 14 column: 8 @@ -93,8 +89,7 @@ expression: diagnostics row: 15 column: 23 fix: - content: - - "assert expr, msg" + content: "assert expr, msg" location: row: 15 column: 8 @@ -197,8 +192,7 @@ expression: diagnostics row: 28 column: 24 fix: - content: - - assert not True + content: assert not True location: row: 28 column: 8 @@ -217,8 +211,7 @@ expression: diagnostics row: 31 column: 24 fix: - content: - - assert 1 == 2 + content: assert 1 == 2 location: row: 31 column: 8 @@ -237,8 +230,7 @@ expression: diagnostics row: 34 column: 27 fix: - content: - - assert 1 != 1 + content: assert 1 != 1 location: row: 34 column: 8 @@ -257,8 +249,7 @@ expression: diagnostics row: 37 column: 26 fix: - content: - - assert 1 > 2 + content: assert 1 > 2 location: row: 37 column: 8 @@ -277,8 +268,7 @@ expression: diagnostics row: 40 column: 31 fix: - content: - - assert 1 >= 2 + content: assert 1 >= 2 location: row: 40 column: 8 @@ -297,8 +287,7 @@ expression: diagnostics row: 43 column: 23 fix: - content: - - assert 2 < 1 + content: assert 2 < 1 location: row: 43 column: 8 @@ -317,8 +306,7 @@ expression: diagnostics row: 46 column: 28 fix: - content: - - assert 1 <= 2 + content: assert 1 <= 2 location: row: 46 column: 8 @@ -337,8 +325,7 @@ expression: diagnostics row: 49 column: 21 fix: - content: - - "assert 1 in [2, 3]" + content: "assert 1 in [2, 3]" location: row: 49 column: 8 @@ -357,8 +344,7 @@ expression: diagnostics row: 52 column: 24 fix: - content: - - "assert 2 not in [2, 3]" + content: "assert 2 not in [2, 3]" location: row: 52 column: 8 @@ -377,8 +363,7 @@ expression: diagnostics row: 55 column: 25 fix: - content: - - assert 0 is None + content: assert 0 is None location: row: 55 column: 8 @@ -397,8 +382,7 @@ expression: diagnostics row: 58 column: 28 fix: - content: - - assert 0 is not None + content: assert 0 is not None location: row: 58 column: 8 @@ -417,8 +401,7 @@ expression: diagnostics row: 61 column: 21 fix: - content: - - "assert [] is []" + content: "assert [] is []" location: row: 61 column: 8 @@ -437,8 +420,7 @@ expression: diagnostics row: 64 column: 24 fix: - content: - - assert 1 is not 1 + content: assert 1 is not 1 location: row: 64 column: 8 @@ -457,8 +439,7 @@ expression: diagnostics row: 67 column: 29 fix: - content: - - "assert isinstance(1, str)" + content: "assert isinstance(1, str)" location: row: 67 column: 8 @@ -477,8 +458,7 @@ expression: diagnostics row: 70 column: 32 fix: - content: - - "assert not isinstance(1, int)" + content: "assert not isinstance(1, int)" location: row: 70 column: 8 @@ -497,8 +477,7 @@ expression: diagnostics row: 73 column: 24 fix: - content: - - "assert re.search(\"def\", \"abc\")" + content: "assert re.search(\"def\", \"abc\")" location: row: 73 column: 8 @@ -517,8 +496,7 @@ expression: diagnostics row: 76 column: 27 fix: - content: - - "assert not re.search(\"abc\", \"abc\")" + content: "assert not re.search(\"abc\", \"abc\")" location: row: 76 column: 8 @@ -537,8 +515,7 @@ expression: diagnostics row: 79 column: 32 fix: - content: - - "assert re.search(\"def\", \"abc\")" + content: "assert re.search(\"def\", \"abc\")" location: row: 79 column: 8 @@ -557,8 +534,7 @@ expression: diagnostics row: 82 column: 27 fix: - content: - - "assert not re.search(\"abc\", \"abc\")" + content: "assert not re.search(\"abc\", \"abc\")" location: row: 82 column: 8 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT018.snap index 0a627c2887..8ac810c35c 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT018.snap @@ -12,9 +12,7 @@ expression: diagnostics row: 13 column: 39 fix: - content: - - assert something - - assert something_else + content: "assert something\nassert something_else" location: row: 13 column: 4 @@ -32,10 +30,7 @@ expression: diagnostics row: 14 column: 59 fix: - content: - - assert something - - assert something_else - - assert something_third + content: "assert something\nassert something_else\nassert something_third" location: row: 14 column: 4 @@ -53,9 +48,7 @@ expression: diagnostics row: 15 column: 43 fix: - content: - - assert something - - assert not something_else + content: "assert something\nassert not something_else" location: row: 15 column: 4 @@ -73,9 +66,7 @@ expression: diagnostics row: 16 column: 60 fix: - content: - - assert something - - assert something_else or something_third + content: "assert something\nassert something_else or something_third" location: row: 16 column: 4 @@ -93,9 +84,7 @@ expression: diagnostics row: 17 column: 43 fix: - content: - - assert not something - - assert something_else + content: "assert not something\nassert something_else" location: row: 17 column: 4 @@ -113,9 +102,7 @@ expression: diagnostics row: 18 column: 44 fix: - content: - - assert not something - - assert not something_else + content: "assert not something\nassert not something_else" location: row: 18 column: 4 @@ -133,10 +120,7 @@ expression: diagnostics row: 19 column: 63 fix: - content: - - assert not something - - assert not something_else - - assert not something_third + content: "assert not something\nassert not something_else\nassert not something_third" location: row: 19 column: 4 @@ -154,9 +138,7 @@ expression: diagnostics row: 22 column: 34 fix: - content: - - assert not a - - assert b or c + content: "assert not a\nassert b or c" location: row: 22 column: 4 @@ -174,9 +156,7 @@ expression: diagnostics row: 23 column: 35 fix: - content: - - assert not a - - assert b and c + content: "assert not a\nassert b and c" location: row: 23 column: 4 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT022.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT022.snap index 1e4abbc574..015daac6d6 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT022.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT022.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 17 column: 18 fix: - content: - - return + content: return location: row: 17 column: 4 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_default.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_default.snap index 0424679677..712c313caa 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_default.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_default.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 12 column: 16 fix: - content: - - () + content: () location: row: 12 column: 16 @@ -35,8 +34,7 @@ expression: diagnostics row: 17 column: 16 fix: - content: - - () + content: () location: row: 17 column: 16 @@ -56,8 +54,7 @@ expression: diagnostics row: 24 column: 20 fix: - content: - - () + content: () location: row: 24 column: 20 @@ -77,8 +74,7 @@ expression: diagnostics row: 30 column: 20 fix: - content: - - () + content: () location: row: 30 column: 20 @@ -98,8 +94,7 @@ expression: diagnostics row: 38 column: 24 fix: - content: - - () + content: () location: row: 38 column: 24 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap index 569b97f9cc..4d892e7c37 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 46 column: 18 fix: - content: - - "" + content: "" location: row: 46 column: 16 @@ -35,8 +34,7 @@ expression: diagnostics row: 51 column: 18 fix: - content: - - "" + content: "" location: row: 51 column: 16 @@ -56,8 +54,7 @@ expression: diagnostics row: 58 column: 22 fix: - content: - - "" + content: "" location: row: 58 column: 20 @@ -77,8 +74,7 @@ expression: diagnostics row: 64 column: 22 fix: - content: - - "" + content: "" location: row: 64 column: 20 @@ -98,8 +94,7 @@ expression: diagnostics row: 72 column: 26 fix: - content: - - "" + content: "" location: row: 72 column: 24 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT024.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT024.snap index d965e7ae62..99b1358e21 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT024.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT024.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 14 column: 22 fix: - content: - - "" + content: "" location: row: 14 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 20 column: 20 fix: - content: - - "" + content: "" location: row: 20 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 27 column: 22 fix: - content: - - "" + content: "" location: row: 27 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 33 column: 20 fix: - content: - - "" + content: "" location: row: 33 column: 0 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT025.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT025.snap index 6849bf52ef..83049646a4 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT025.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT025.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 9 column: 29 fix: - content: - - "" + content: "" location: row: 9 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 16 column: 29 fix: - content: - - "" + content: "" location: row: 16 column: 0 diff --git a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT026.snap index 4a49022ee5..b46afbd28b 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff/src/rules/flake8_pytest_style/snapshots/ruff__rules__flake8_pytest_style__tests__PT026.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_pytest_style/mod.rs +source: crates/ruff/src/rules/flake8_pytest_style/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 19 column: 26 fix: - content: - - "" + content: "" location: row: 19 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 24 column: 24 fix: - content: - - "" + content: "" location: row: 24 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/mod.rs b/crates/ruff/src/rules/flake8_quotes/mod.rs index 592401aa56..6764144dcf 100644 --- a/crates/ruff/src/rules/flake8_quotes/mod.rs +++ b/crates/ruff/src/rules/flake8_quotes/mod.rs @@ -7,10 +7,10 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use super::settings::Quote; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap index b55d0b4977..534a6af516 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 7 column: 3 fix: - content: - - "'''" - - this is not a docstring - - "'''" + content: "'''\nthis is not a docstring\n'''" location: row: 5 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 18 column: 7 fix: - content: - - "'''" - - " this is not a docstring" - - " '''" + content: "'''\n this is not a docstring\n '''" location: row: 16 column: 4 @@ -54,9 +48,7 @@ expression: diagnostics row: 22 column: 37 fix: - content: - - "'''" - - " definitely not a docstring'''" + content: "'''\n definitely not a docstring'''" location: row: 21 column: 20 @@ -74,10 +66,7 @@ expression: diagnostics row: 32 column: 11 fix: - content: - - "'''" - - " this is not a docstring" - - " '''" + content: "'''\n this is not a docstring\n '''" location: row: 30 column: 8 @@ -95,10 +84,7 @@ expression: diagnostics row: 37 column: 15 fix: - content: - - "'''" - - " Looks like a docstring, but in reality it isn't - only modules, classes and functions" - - " '''" + content: "'''\n Looks like a docstring, but in reality it isn't - only modules, classes and functions\n '''" location: row: 35 column: 12 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap index 0d6b2e09ad..1ac2733d7b 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 27 fix: - content: - - "''' Not a docstring '''" + content: "''' Not a docstring '''" location: row: 3 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 5 column: 43 fix: - content: - - "'''not a docstring'''" + content: "'''not a docstring'''" location: row: 5 column: 22 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap index 33f6aca47b..8d9c66f7c6 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 26 fix: - content: - - "''' not a docstring'''" + content: "''' not a docstring'''" location: row: 3 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 11 column: 26 fix: - content: - - "''' not a docstring'''" + content: "''' not a docstring'''" location: row: 11 column: 4 @@ -50,10 +48,7 @@ expression: diagnostics row: 17 column: 3 fix: - content: - - "'''" - - " not a" - - "'''" + content: "'''\n not a\n'''" location: row: 15 column: 38 @@ -71,8 +66,7 @@ expression: diagnostics row: 17 column: 19 fix: - content: - - "'''docstring'''" + content: "'''docstring'''" location: row: 17 column: 4 @@ -90,8 +84,7 @@ expression: diagnostics row: 22 column: 27 fix: - content: - - "''' not a docstring '''" + content: "''' not a docstring '''" location: row: 22 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap index 2047cdc9fe..3bc1e04316 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 6 column: 3 fix: - content: - - "'''" - - this is not a docstring - - "'''" + content: "'''\nthis is not a docstring\n'''" location: row: 4 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 11 column: 3 fix: - content: - - "'''" - - this is not a docstring - - "'''" + content: "'''\nthis is not a docstring\n'''" location: row: 9 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap index fc8cb599f1..06247b3663 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 31 fix: - content: - - "''' this is not a docstring '''" + content: "''' this is not a docstring '''" location: row: 2 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 31 fix: - content: - - "''' this is not a docstring '''" + content: "''' this is not a docstring '''" location: row: 6 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap index 5f6ea86b32..0a15cbdb24 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 3 fix: - content: - - "\"\"\"" - - Single quotes multiline module docstring - - "\"\"\"" + content: "\"\"\"\nSingle quotes multiline module docstring\n\"\"\"" location: row: 1 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 16 column: 7 fix: - content: - - "\"\"\"" - - " Single quotes multiline class docstring" - - " \"\"\"" + content: "\"\"\"\n Single quotes multiline class docstring\n \"\"\"" location: row: 14 column: 4 @@ -54,10 +48,7 @@ expression: diagnostics row: 28 column: 11 fix: - content: - - "\"\"\"" - - " Single quotes multiline function docstring" - - " \"\"\"" + content: "\"\"\"\n Single quotes multiline function docstring\n \"\"\"" location: row: 26 column: 8 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap index 39ae7bc8b0..4da2b1336b 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 53 fix: - content: - - "\"\"\" Double quotes single line class docstring \"\"\"" + content: "\"\"\" Double quotes single line class docstring \"\"\"" location: row: 2 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 57 fix: - content: - - "\"\"\" Double quotes single line method docstring\"\"\"" + content: "\"\"\" Double quotes single line method docstring\"\"\"" location: row: 6 column: 8 @@ -50,8 +48,7 @@ expression: diagnostics row: 9 column: 52 fix: - content: - - "\"\"\" inline docstring \"\"\"" + content: "\"\"\" inline docstring \"\"\"" location: row: 9 column: 28 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap index 8847d832d7..08c01b1922 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 56 fix: - content: - - "\"\"\"function without params, single line docstring\"\"\"" + content: "\"\"\"function without params, single line docstring\"\"\"" location: row: 2 column: 4 @@ -31,10 +30,7 @@ expression: diagnostics row: 10 column: 7 fix: - content: - - "\"\"\"" - - " function without params, multiline docstring" - - " \"\"\"" + content: "\"\"\"\n function without params, multiline docstring\n \"\"\"" location: row: 8 column: 4 @@ -52,8 +48,7 @@ expression: diagnostics row: 27 column: 27 fix: - content: - - "\"Single line docstring\"" + content: "\"Single line docstring\"" location: row: 27 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap index 240201b22e..4115e98c37 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 3 fix: - content: - - "\"\"\"" - - Double quotes multiline module docstring - - "\"\"\"" + content: "\"\"\"\nDouble quotes multiline module docstring\n\"\"\"" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap index 7eab77c29b..6e2497a1f8 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 49 fix: - content: - - "\"\"\" Double quotes singleline module docstring \"\"\"" + content: "\"\"\" Double quotes singleline module docstring \"\"\"" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap index 8ad3394938..a19e53c8a0 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 3 fix: - content: - - "'''" - - Double quotes multiline module docstring - - "'''" + content: "'''\nDouble quotes multiline module docstring\n'''" location: row: 1 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 14 column: 7 fix: - content: - - "'''" - - " Double quotes multiline class docstring" - - " '''" + content: "'''\n Double quotes multiline class docstring\n '''" location: row: 12 column: 4 @@ -54,10 +48,7 @@ expression: diagnostics row: 26 column: 11 fix: - content: - - "'''" - - " Double quotes multiline function docstring" - - " '''" + content: "'''\n Double quotes multiline function docstring\n '''" location: row: 24 column: 8 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap index 10301afe51..44491c9f6f 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 53 fix: - content: - - "''' Double quotes single line class docstring '''" + content: "''' Double quotes single line class docstring '''" location: row: 2 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 57 fix: - content: - - "''' Double quotes single line method docstring'''" + content: "''' Double quotes single line method docstring'''" location: row: 6 column: 8 @@ -50,8 +48,7 @@ expression: diagnostics row: 9 column: 52 fix: - content: - - "''' inline docstring '''" + content: "''' inline docstring '''" location: row: 9 column: 28 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap index 2097c34eb1..6b3808fada 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 56 fix: - content: - - "'''function without params, single line docstring'''" + content: "'''function without params, single line docstring'''" location: row: 2 column: 4 @@ -31,10 +30,7 @@ expression: diagnostics row: 10 column: 7 fix: - content: - - "'''" - - " function without params, multiline docstring" - - " '''" + content: "'''\n function without params, multiline docstring\n '''" location: row: 8 column: 4 @@ -52,8 +48,7 @@ expression: diagnostics row: 27 column: 27 fix: - content: - - "'Single line docstring'" + content: "'Single line docstring'" location: row: 27 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap index 02cb2e7f94..7554c8f5b2 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 3 fix: - content: - - "'''" - - Double quotes multiline module docstring - - "'''" + content: "'''\nDouble quotes multiline module docstring\n'''" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap index 022eee3074..812900e5d2 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 49 fix: - content: - - "''' Double quotes singleline module docstring '''" + content: "''' Double quotes singleline module docstring '''" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap index 78a89e722a..31dd08bffd 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 7 column: 3 fix: - content: - - "\"\"\"" - - this is not a docstring - - "\"\"\"" + content: "\"\"\"\nthis is not a docstring\n\"\"\"" location: row: 5 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 13 column: 3 fix: - content: - - "\"\"\"" - - " class params \\t not a docstring" - - "\"\"\"" + content: "\"\"\"\n class params \\t not a docstring\n\"\"\"" location: row: 11 column: 20 @@ -54,10 +48,7 @@ expression: diagnostics row: 20 column: 7 fix: - content: - - "\"\"\"" - - " this is not a docstring" - - " \"\"\"" + content: "\"\"\"\n this is not a docstring\n \"\"\"" location: row: 18 column: 4 @@ -75,9 +66,7 @@ expression: diagnostics row: 24 column: 37 fix: - content: - - "\"\"\"" - - " definitely not a docstring\"\"\"" + content: "\"\"\"\n definitely not a docstring\"\"\"" location: row: 23 column: 20 @@ -95,10 +84,7 @@ expression: diagnostics row: 34 column: 11 fix: - content: - - "\"\"\"" - - " this is not a docstring" - - " \"\"\"" + content: "\"\"\"\n this is not a docstring\n \"\"\"" location: row: 32 column: 8 @@ -116,10 +102,7 @@ expression: diagnostics row: 39 column: 15 fix: - content: - - "\"\"\"" - - " Looks like a docstring, but in reality it isn't - only modules, classes and functions" - - " \"\"\"" + content: "\"\"\"\n Looks like a docstring, but in reality it isn't - only modules, classes and functions\n \"\"\"" location: row: 37 column: 12 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap index 0ba2a4ef3a..c31ce94b7f 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 27 fix: - content: - - "\"\"\" Not a docstring \"\"\"" + content: "\"\"\" Not a docstring \"\"\"" location: row: 3 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 5 column: 43 fix: - content: - - "\"\"\"not a docstring\"\"\"" + content: "\"\"\"not a docstring\"\"\"" location: row: 5 column: 22 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap index 93ba88b6c5..10fc5ae380 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 26 fix: - content: - - "\"\"\" not a docstring\"\"\"" + content: "\"\"\" not a docstring\"\"\"" location: row: 3 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 11 column: 26 fix: - content: - - "\"\"\" not a docstring\"\"\"" + content: "\"\"\" not a docstring\"\"\"" location: row: 11 column: 4 @@ -50,10 +48,7 @@ expression: diagnostics row: 17 column: 3 fix: - content: - - "\"\"\"" - - " not a" - - "\"\"\"" + content: "\"\"\"\n not a\n\"\"\"" location: row: 15 column: 38 @@ -71,8 +66,7 @@ expression: diagnostics row: 17 column: 19 fix: - content: - - "\"\"\"docstring\"\"\"" + content: "\"\"\"docstring\"\"\"" location: row: 17 column: 4 @@ -90,8 +84,7 @@ expression: diagnostics row: 22 column: 27 fix: - content: - - "\"\"\" not a docstring \"\"\"" + content: "\"\"\" not a docstring \"\"\"" location: row: 22 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap index 0e82762331..d8b3e55378 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 6 column: 3 fix: - content: - - "\"\"\"" - - this is not a docstring - - "\"\"\"" + content: "\"\"\"\nthis is not a docstring\n\"\"\"" location: row: 4 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 11 column: 3 fix: - content: - - "\"\"\"" - - this is not a docstring - - "\"\"\"" + content: "\"\"\"\nthis is not a docstring\n\"\"\"" location: row: 9 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap index 03f42dbfbd..2a971926d0 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 31 fix: - content: - - "\"\"\" this is not a docstring \"\"\"" + content: "\"\"\" this is not a docstring \"\"\"" location: row: 2 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 31 fix: - content: - - "\"\"\" this is not a docstring \"\"\"" + content: "\"\"\" this is not a docstring \"\"\"" location: row: 6 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap index 971368cc82..f4adff17f4 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 45 fix: - content: - - "\"single quote string\"" + content: "\"single quote string\"" location: row: 1 column: 24 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 46 fix: - content: - - "u\"double quote string\"" + content: "u\"double quote string\"" location: row: 2 column: 24 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 46 fix: - content: - - "f\"double quote string\"" + content: "f\"double quote string\"" location: row: 3 column: 24 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap index db2f4d9a5d..8abf62ca72 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 47 fix: - content: - - "'This is a \"string\"'" + content: "'This is a \"string\"'" location: row: 1 column: 25 @@ -29,8 +28,7 @@ expression: diagnostics row: 9 column: 16 fix: - content: - - "'\"string\"'" + content: "'\"string\"'" location: row: 9 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap index 4a35ad1bc5..a8846bd8f9 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 10 fix: - content: - - "\"This\"" + content: "\"This\"" location: row: 2 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 3 column: 8 fix: - content: - - "\"is\"" + content: "\"is\"" location: row: 3 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 4 column: 9 fix: - content: - - "\"not\"" + content: "\"not\"" location: row: 4 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 8 column: 10 fix: - content: - - "\"This\"" + content: "\"This\"" location: row: 8 column: 4 @@ -88,8 +84,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - "\"is\"" + content: "\"is\"" location: row: 9 column: 4 @@ -107,8 +102,7 @@ expression: diagnostics row: 10 column: 9 fix: - content: - - "\"not\"" + content: "\"not\"" location: row: 10 column: 4 @@ -126,8 +120,7 @@ expression: diagnostics row: 27 column: 30 fix: - content: - - "\"But this needs to be changed\"" + content: "\"But this needs to be changed\"" location: row: 27 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap index e5b0f65458..8aa0f737ef 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 12 fix: - content: - - "\"\"\" This 'should'" - - be - - "'linted' \"\"\"" + content: "\"\"\" This 'should'\nbe\n'linted' \"\"\"" location: row: 1 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap index 14140205e2..d4b082be31 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 45 fix: - content: - - "'double quote string'" + content: "'double quote string'" location: row: 1 column: 24 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 46 fix: - content: - - "u'double quote string'" + content: "u'double quote string'" location: row: 2 column: 24 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 46 fix: - content: - - "f'double quote string'" + content: "f'double quote string'" location: row: 3 column: 24 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap index 981a70af34..7e1e8673f8 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 47 fix: - content: - - "\"This is a 'string'\"" + content: "\"This is a 'string'\"" location: row: 1 column: 25 @@ -29,8 +28,7 @@ expression: diagnostics row: 2 column: 52 fix: - content: - - "\"This is \\\\ a \\\\'string'\"" + content: "\"This is \\\\ a \\\\'string'\"" location: row: 2 column: 25 @@ -47,8 +45,7 @@ expression: diagnostics row: 10 column: 16 fix: - content: - - "\"'string'\"" + content: "\"'string'\"" location: row: 10 column: 4 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap index 711a82aaac..d0620e2dbb 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 10 fix: - content: - - "'This'" + content: "'This'" location: row: 2 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 3 column: 8 fix: - content: - - "'is'" + content: "'is'" location: row: 3 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 4 column: 9 fix: - content: - - "'not'" + content: "'not'" location: row: 4 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 8 column: 10 fix: - content: - - "'This'" + content: "'This'" location: row: 8 column: 4 @@ -88,8 +84,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - "'is'" + content: "'is'" location: row: 9 column: 4 @@ -107,8 +102,7 @@ expression: diagnostics row: 10 column: 9 fix: - content: - - "'not'" + content: "'not'" location: row: 10 column: 4 @@ -126,8 +120,7 @@ expression: diagnostics row: 27 column: 30 fix: - content: - - "'But this needs to be changed'" + content: "'But this needs to be changed'" location: row: 27 column: 0 diff --git a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap index c2a8ca9d24..b96fa6ab1c 100644 --- a/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap +++ b/crates/ruff/src/rules/flake8_quotes/snapshots/ruff__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_quotes/mod.rs +source: crates/ruff/src/rules/flake8_quotes/mod.rs expression: diagnostics --- - kind: @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 12 fix: - content: - - "''' This \"should\"" - - be - - "\"linted\" '''" + content: "''' This \"should\"\nbe\n\"linted\" '''" location: row: 1 column: 4 diff --git a/crates/ruff/src/rules/flake8_raise/mod.rs b/crates/ruff/src/rules/flake8_raise/mod.rs index 1e0b309c7a..30b3d04c8b 100644 --- a/crates/ruff/src/rules/flake8_raise/mod.rs +++ b/crates/ruff/src/rules/flake8_raise/mod.rs @@ -7,11 +7,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::UnnecessaryParenOnRaiseException, Path::new("RSE102.py"); "RSE102")] fn rules(rule_code: Rule, path: &Path) -> Result<()> { diff --git a/crates/ruff/src/rules/flake8_raise/snapshots/ruff__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap b/crates/ruff/src/rules/flake8_raise/snapshots/ruff__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap index 4dfa58fdd1..3166f31b9d 100644 --- a/crates/ruff/src/rules/flake8_raise/snapshots/ruff__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap +++ b/crates/ruff/src/rules/flake8_raise/snapshots/ruff__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 5 column: 22 fix: - content: - - "" + content: "" location: row: 5 column: 20 @@ -29,8 +28,7 @@ expression: diagnostics row: 13 column: 17 fix: - content: - - "" + content: "" location: row: 13 column: 15 @@ -47,8 +45,7 @@ expression: diagnostics row: 16 column: 18 fix: - content: - - "" + content: "" location: row: 16 column: 15 @@ -65,8 +62,7 @@ expression: diagnostics row: 20 column: 6 fix: - content: - - "" + content: "" location: row: 19 column: 15 @@ -83,8 +79,7 @@ expression: diagnostics row: 25 column: 1 fix: - content: - - "" + content: "" location: row: 23 column: 15 @@ -101,8 +96,7 @@ expression: diagnostics row: 30 column: 1 fix: - content: - - "" + content: "" location: row: 28 column: 15 diff --git a/crates/ruff/src/rules/flake8_return/mod.rs b/crates/ruff/src/rules/flake8_return/mod.rs index 2160c281df..a743e9732a 100644 --- a/crates/ruff/src/rules/flake8_return/mod.rs +++ b/crates/ruff/src/rules/flake8_return/mod.rs @@ -9,9 +9,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET501_RET501.py.snap b/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET501_RET501.py.snap index 6ba7aecc0d..531888d98f 100644 --- a/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET501_RET501.py.snap +++ b/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET501_RET501.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_return/mod.rs +source: crates/ruff/src/rules/flake8_return/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 15 fix: - content: - - return + content: return location: row: 4 column: 4 diff --git a/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET502_RET502.py.snap b/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET502_RET502.py.snap index 2f2461ba5c..802ecbba8b 100644 --- a/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET502_RET502.py.snap +++ b/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET502_RET502.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_return/mod.rs +source: crates/ruff/src/rules/flake8_return/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 3 column: 14 fix: - content: - - return None + content: return None location: row: 3 column: 8 diff --git a/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET503_RET503.py.snap index 62f5aba3bf..353421652b 100644 --- a/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff/src/rules/flake8_return/snapshots/ruff__rules__flake8_return__tests__RET503_RET503.py.snap @@ -11,9 +11,7 @@ expression: diagnostics row: 19 column: 16 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 19 column: 16 @@ -30,9 +28,7 @@ expression: diagnostics row: 25 column: 15 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 25 column: 15 @@ -49,9 +45,7 @@ expression: diagnostics row: 34 column: 11 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 34 column: 11 @@ -68,9 +62,7 @@ expression: diagnostics row: 41 column: 20 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 41 column: 20 @@ -87,9 +79,7 @@ expression: diagnostics row: 50 column: 15 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 50 column: 15 @@ -106,9 +96,7 @@ expression: diagnostics row: 57 column: 22 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 57 column: 22 @@ -125,9 +113,7 @@ expression: diagnostics row: 64 column: 21 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 64 column: 21 @@ -144,9 +130,7 @@ expression: diagnostics row: 83 column: 14 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 83 column: 14 @@ -163,9 +147,7 @@ expression: diagnostics row: 114 column: 16 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 114 column: 16 @@ -182,9 +164,7 @@ expression: diagnostics row: 124 column: 19 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 124 column: 19 @@ -201,9 +181,7 @@ expression: diagnostics row: 131 column: 16 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 131 column: 16 @@ -220,9 +198,7 @@ expression: diagnostics row: 141 column: 19 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 141 column: 19 @@ -239,9 +215,7 @@ expression: diagnostics row: 261 column: 20 fix: - content: - - "" - - " return None" + content: "\n return None" location: row: 261 column: 20 diff --git a/crates/ruff/src/rules/flake8_self/mod.rs b/crates/ruff/src/rules/flake8_self/mod.rs index 11c22c31f2..25fbbc0795 100644 --- a/crates/ruff/src/rules/flake8_self/mod.rs +++ b/crates/ruff/src/rules/flake8_self/mod.rs @@ -8,11 +8,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::PrivateMemberAccess, Path::new("SLF001.py"); "SLF001")] fn rules(rule_code: Rule, path: &Path) -> Result<()> { diff --git a/crates/ruff/src/rules/flake8_simplify/mod.rs b/crates/ruff/src/rules/flake8_simplify/mod.rs index d8fc8ca467..e8471e5192 100644 --- a/crates/ruff/src/rules/flake8_simplify/mod.rs +++ b/crates/ruff/src/rules/flake8_simplify/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::DuplicateIsinstanceCall, Path::new("SIM101.py"); "SIM101")] #[test_case(Rule::CollapsibleIf, Path::new("SIM102.py"); "SIM102")] diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index dc24462b7d..a9a1925cc2 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 45 fix: - content: - - "isinstance(a, (int, float))" + content: "isinstance(a, (int, float))" location: row: 1 column: 3 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 53 fix: - content: - - "isinstance(a, (int, float, bool))" + content: "isinstance(a, (int, float, bool))" location: row: 4 column: 3 @@ -50,8 +48,7 @@ expression: diagnostics row: 7 column: 68 fix: - content: - - "isinstance(a, (int, float)) or isinstance(b, bool)" + content: "isinstance(a, (int, float)) or isinstance(b, bool)" location: row: 7 column: 3 @@ -69,8 +66,7 @@ expression: diagnostics row: 10 column: 68 fix: - content: - - "isinstance(a, (int, float)) or isinstance(b, bool)" + content: "isinstance(a, (int, float)) or isinstance(b, bool)" location: row: 10 column: 3 @@ -88,8 +84,7 @@ expression: diagnostics row: 13 column: 68 fix: - content: - - "isinstance(a, (int, float)) or isinstance(b, bool)" + content: "isinstance(a, (int, float)) or isinstance(b, bool)" location: row: 13 column: 3 @@ -107,8 +102,7 @@ expression: diagnostics row: 16 column: 46 fix: - content: - - "isinstance(a, (int, float))" + content: "isinstance(a, (int, float))" location: row: 16 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index 6a4ecd1265..0e166522c9 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 9 fix: - content: - - "if a and b:" - - " c" - - "" + content: "if a and b:\n c\n" location: row: 2 column: 0 @@ -33,11 +30,7 @@ expression: diagnostics row: 9 column: 13 fix: - content: - - "if a and b:" - - " if c:" - - " d" - - "" + content: "if a and b:\n if c:\n d\n" location: row: 7 column: 0 @@ -55,10 +48,7 @@ expression: diagnostics row: 16 column: 9 fix: - content: - - "elif b and c:" - - " d" - - "" + content: "elif b and c:\n d\n" location: row: 15 column: 0 @@ -87,11 +77,7 @@ expression: diagnostics row: 27 column: 9 fix: - content: - - "if a and b:" - - " # Fixable due to placement of this comment." - - " c" - - "" + content: "if a and b:\n # Fixable due to placement of this comment.\n c\n" location: row: 26 column: 0 @@ -109,20 +95,7 @@ expression: diagnostics row: 52 column: 16 fix: - content: - - " if True and True:" - - " \"\"\"this" - - "is valid\"\"\"" - - "" - - " \"\"\"the indentation on" - - " this line is significant\"\"\"" - - "" - - " \"this is\" \\" - - "\"allowed too\"" - - "" - - " (\"so is\"" - - "\"this for some reason\")" - - "" + content: " if True and True:\n \"\"\"this\nis valid\"\"\"\n\n \"\"\"the indentation on\n this line is significant\"\"\"\n\n \"this is\" \\\n\"allowed too\"\n\n (\"so is\"\n\"this for some reason\")\n" location: row: 51 column: 0 @@ -140,20 +113,7 @@ expression: diagnostics row: 68 column: 12 fix: - content: - - "if True and True:" - - " \"\"\"this" - - "is valid\"\"\"" - - "" - - " \"\"\"the indentation on" - - " this line is significant\"\"\"" - - "" - - " \"this is\" \\" - - "\"allowed too\"" - - "" - - " (\"so is\"" - - "\"this for some reason\")" - - "" + content: "if True and True:\n \"\"\"this\nis valid\"\"\"\n\n \"\"\"the indentation on\n this line is significant\"\"\"\n\n \"this is\" \\\n\"allowed too\"\n\n (\"so is\"\n\"this for some reason\")\n" location: row: 67 column: 0 @@ -171,12 +131,7 @@ expression: diagnostics row: 86 column: 10 fix: - content: - - " if node.module and (node.module == \"multiprocessing\" or node.module.startswith(" - - " \"multiprocessing.\"" - - " )):" - - " print(\"Bad module!\")" - - "" + content: " if node.module and (node.module == \"multiprocessing\" or node.module.startswith(\n \"multiprocessing.\"\n )):\n print(\"Bad module!\")\n" location: row: 83 column: 0 @@ -194,12 +149,7 @@ expression: diagnostics row: 93 column: 6 fix: - content: - - "if node.module and (node.module == \"multiprocessing\" or node.module.startswith(" - - " \"multiprocessing.\"" - - ")):" - - " print(\"Bad module!\")" - - "" + content: "if node.module and (node.module == \"multiprocessing\" or node.module.startswith(\n \"multiprocessing.\"\n)):\n print(\"Bad module!\")\n" location: row: 90 column: 0 @@ -217,10 +167,7 @@ expression: diagnostics row: 118 column: 13 fix: - content: - - " if b and c:" - - " print(\"foo\")" - - "" + content: " if b and c:\n print(\"foo\")\n" location: row: 117 column: 0 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index bdf4a0593b..458047ecb4 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 6 column: 20 fix: - content: - - return bool(a) + content: return bool(a) location: row: 3 column: 4 @@ -33,8 +32,7 @@ expression: diagnostics row: 14 column: 20 fix: - content: - - return a == b + content: return a == b location: row: 11 column: 4 @@ -53,8 +51,7 @@ expression: diagnostics row: 24 column: 20 fix: - content: - - return bool(b) + content: return bool(b) location: row: 21 column: 4 @@ -73,8 +70,7 @@ expression: diagnostics row: 35 column: 24 fix: - content: - - return bool(b) + content: return bool(b) location: row: 32 column: 8 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index 0ff0d01b5e..82e0462b7f 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 5 column: 9 fix: - content: - - b = c if a else d + content: b = c if a else d location: row: 2 column: 0 @@ -45,8 +44,7 @@ expression: diagnostics row: 85 column: 45 fix: - content: - - b = cccccccccccccccccccccccccccccccccccc if a else ddddddddddddddddddddddddddddddddddddd + content: b = cccccccccccccccccccccccccccccccccccc if a else ddddddddddddddddddddddddddddddddddddd location: row: 82 column: 0 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index 51760b4a8d..b5d10acfe1 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 19 fix: - content: - - "a in (b, c)" + content: "a in (b, c)" location: row: 2 column: 3 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 20 fix: - content: - - "a in (b, c)" + content: "a in (b, c)" location: row: 6 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 10 column: 27 fix: - content: - - "a in (b, c) or None" + content: "a in (b, c) or None" location: row: 10 column: 3 @@ -69,8 +66,7 @@ expression: diagnostics row: 14 column: 27 fix: - content: - - "a in (b, c) or None" + content: "a in (b, c) or None" location: row: 14 column: 3 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index 58fb11c80c..16234811dd 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 5 column: 23 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 3 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 27 column: 24 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 25 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 35 column: 24 fix: - content: - - return all(x.is_empty() for x in iterable) + content: return all(x.is_empty() for x in iterable) location: row: 33 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 59 column: 20 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 55 column: 4 @@ -88,8 +84,7 @@ expression: diagnostics row: 68 column: 19 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 64 column: 4 @@ -107,8 +102,7 @@ expression: diagnostics row: 77 column: 20 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 73 column: 4 @@ -126,8 +120,7 @@ expression: diagnostics row: 87 column: 19 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 83 column: 4 @@ -167,8 +160,7 @@ expression: diagnostics row: 146 column: 23 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 144 column: 4 @@ -186,8 +178,7 @@ expression: diagnostics row: 156 column: 24 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 154 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index 78edd2fbbe..3c7dce7de6 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 5 column: 23 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 3 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 27 column: 24 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 25 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 35 column: 24 fix: - content: - - return all(x.is_empty() for x in iterable) + content: return all(x.is_empty() for x in iterable) location: row: 33 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 59 column: 20 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 55 column: 4 @@ -88,8 +84,7 @@ expression: diagnostics row: 68 column: 19 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 64 column: 4 @@ -107,8 +102,7 @@ expression: diagnostics row: 77 column: 20 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 73 column: 4 @@ -126,8 +120,7 @@ expression: diagnostics row: 87 column: 19 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 83 column: 4 @@ -167,8 +160,7 @@ expression: diagnostics row: 146 column: 23 fix: - content: - - return any(check(x) for x in iterable) + content: return any(check(x) for x in iterable) location: row: 144 column: 4 @@ -186,8 +178,7 @@ expression: diagnostics row: 156 column: 24 fix: - content: - - return all(not check(x) for x in iterable) + content: return all(not check(x) for x in iterable) location: row: 154 column: 4 @@ -205,8 +196,7 @@ expression: diagnostics row: 164 column: 24 fix: - content: - - return all(x in y for x in iterable) + content: return all(x in y for x in iterable) location: row: 162 column: 4 @@ -224,8 +214,7 @@ expression: diagnostics row: 172 column: 24 fix: - content: - - return all(x <= y for x in iterable) + content: return all(x <= y for x in iterable) location: row: 170 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index d6de3e597c..14caa6dde2 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 4 column: 16 fix: - content: - - "'FOO'" + content: "'FOO'" location: row: 4 column: 11 @@ -33,8 +32,7 @@ expression: diagnostics row: 6 column: 20 fix: - content: - - "'FOO'" + content: "'FOO'" location: row: 6 column: 15 @@ -53,8 +51,7 @@ expression: diagnostics row: 8 column: 20 fix: - content: - - "'FOO'" + content: "'FOO'" location: row: 8 column: 15 @@ -73,8 +70,7 @@ expression: diagnostics row: 10 column: 15 fix: - content: - - "'FOO'" + content: "'FOO'" location: row: 10 column: 10 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index 7fc7b76d37..3136c30e8f 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -12,10 +12,7 @@ expression: diagnostics row: 3 column: 18 fix: - content: - - "with A() as a, B() as b:" - - " print(\"hello\")" - - "" + content: "with A() as a, B() as b:\n print(\"hello\")\n" location: row: 2 column: 0 @@ -33,11 +30,7 @@ expression: diagnostics row: 9 column: 17 fix: - content: - - "with A(), B():" - - " with C():" - - " print(\"hello\")" - - "" + content: "with A(), B():\n with C():\n print(\"hello\")\n" location: row: 7 column: 0 @@ -66,11 +59,7 @@ expression: diagnostics row: 20 column: 18 fix: - content: - - "with A() as a, B() as b:" - - " # Fixable due to placement of this comment." - - " print(\"hello\")" - - "" + content: "with A() as a, B() as b:\n # Fixable due to placement of this comment.\n print(\"hello\")\n" location: row: 19 column: 0 @@ -88,20 +77,7 @@ expression: diagnostics row: 54 column: 22 fix: - content: - - " with A() as a, B() as b:" - - " \"\"\"this" - - "is valid\"\"\"" - - "" - - " \"\"\"the indentation on" - - " this line is significant\"\"\"" - - "" - - " \"this is\" \\" - - "\"allowed too\"" - - "" - - " (\"so is\"" - - "\"this for some reason\")" - - "" + content: " with A() as a, B() as b:\n \"\"\"this\nis valid\"\"\"\n\n \"\"\"the indentation on\n this line is significant\"\"\"\n\n \"this is\" \\\n\"allowed too\"\n\n (\"so is\"\n\"this for some reason\")\n" location: row: 53 column: 0 @@ -119,13 +95,7 @@ expression: diagnostics row: 72 column: 18 fix: - content: - - with ( - - " A() as a," - - " B() as b,C() as c" - - "):" - - " print(\"hello\")" - - "" + content: "with (\n A() as a,\n B() as b,C() as c\n):\n print(\"hello\")\n" location: row: 68 column: 0 @@ -143,13 +113,7 @@ expression: diagnostics row: 80 column: 6 fix: - content: - - with ( - - " A() as a, B() as b," - - " C() as c," - - "):" - - " print(\"hello\")" - - "" + content: "with (\n A() as a, B() as b,\n C() as c,\n):\n print(\"hello\")\n" location: row: 76 column: 0 @@ -167,14 +131,7 @@ expression: diagnostics row: 91 column: 6 fix: - content: - - with ( - - " A() as a," - - " B() as b,C() as c," - - " D() as d," - - "):" - - " print(\"hello\")" - - "" + content: "with (\n A() as a,\n B() as b,C() as c,\n D() as d,\n):\n print(\"hello\")\n" location: row: 84 column: 0 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index d683148965..c734371f22 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 1 column: 17 fix: - content: - - obj + content: obj location: row: 1 column: 7 @@ -33,8 +32,7 @@ expression: diagnostics row: 3 column: 24 fix: - content: - - obj + content: obj location: row: 3 column: 14 @@ -53,8 +51,7 @@ expression: diagnostics row: 5 column: 24 fix: - content: - - obj + content: obj location: row: 5 column: 14 @@ -73,8 +70,7 @@ expression: diagnostics row: 7 column: 19 fix: - content: - - obj + content: obj location: row: 7 column: 9 @@ -93,8 +89,7 @@ expression: diagnostics row: 9 column: 21 fix: - content: - - obj + content: obj location: row: 9 column: 11 @@ -113,8 +108,7 @@ expression: diagnostics row: 16 column: 22 fix: - content: - - obj + content: obj location: row: 16 column: 12 @@ -133,8 +127,7 @@ expression: diagnostics row: 18 column: 22 fix: - content: - - obj + content: obj location: row: 18 column: 12 @@ -153,8 +146,7 @@ expression: diagnostics row: 20 column: 25 fix: - content: - - obj + content: obj location: row: 20 column: 15 @@ -173,8 +165,7 @@ expression: diagnostics row: 22 column: 22 fix: - content: - - obj + content: obj location: row: 22 column: 12 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM201_SIM201.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM201_SIM201.py.snap index 9661ae8894..d5ff81236c 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM201_SIM201.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM201_SIM201.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 2 column: 13 fix: - content: - - a != b + content: a != b location: row: 2 column: 3 @@ -33,8 +32,7 @@ expression: diagnostics row: 6 column: 19 fix: - content: - - a != b + c + content: a != b + c location: row: 6 column: 3 @@ -53,8 +51,7 @@ expression: diagnostics row: 10 column: 19 fix: - content: - - a + b != c + content: a + b != c location: row: 10 column: 3 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index 007b84a190..d910d1c2bd 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 2 column: 13 fix: - content: - - a == b + content: a == b location: row: 2 column: 3 @@ -33,8 +32,7 @@ expression: diagnostics row: 6 column: 19 fix: - content: - - a == b + c + content: a == b + c location: row: 6 column: 3 @@ -53,8 +51,7 @@ expression: diagnostics row: 10 column: 19 fix: - content: - - a + b == c + content: a + b == c location: row: 10 column: 3 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index 6b1d1e2323..edcd4bf246 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 14 fix: - content: - - a + content: a location: row: 1 column: 3 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 21 fix: - content: - - a == b + content: a == b location: row: 4 column: 3 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index b2609d824e..396ce97822 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 24 fix: - content: - - bool(b) + content: bool(b) location: row: 1 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 3 column: 29 fix: - content: - - b != c + content: b != c location: row: 3 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 5 column: 28 fix: - content: - - bool(b + c) + content: bool(b + c) location: row: 5 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index 59aa8ef378..b3affb03f0 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 24 fix: - content: - - not b + content: not b location: row: 1 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 3 column: 29 fix: - content: - - not b != c + content: not b != c location: row: 3 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 5 column: 28 fix: - content: - - not b + c + content: not b + c location: row: 5 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index e458adf386..0f7838f8ea 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 1 column: 21 fix: - content: - - a if a else b + content: a if a else b location: row: 1 column: 4 @@ -33,8 +32,7 @@ expression: diagnostics row: 3 column: 25 fix: - content: - - a if a else b + c + content: a if a else b + c location: row: 3 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index 9f3a63cd97..c11183b9fa 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 14 fix: - content: - - "False" + content: "False" location: row: 1 column: 3 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 15 fix: - content: - - "False" + content: "False" location: row: 4 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 7 column: 15 fix: - content: - - "False" + content: "False" location: row: 7 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index 790ee5b494..10c9f24ac7 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 13 fix: - content: - - "True" + content: "True" location: row: 1 column: 3 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 14 fix: - content: - - "True" + content: "True" location: row: 4 column: 4 @@ -50,8 +48,7 @@ expression: diagnostics row: 7 column: 14 fix: - content: - - "True" + content: "True" location: row: 7 column: 4 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index 4d5ac656fc..b519d100e0 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 12 fix: - content: - - "True" + content: "True" location: row: 1 column: 3 @@ -29,8 +28,7 @@ expression: diagnostics row: 4 column: 19 fix: - content: - - "True" + content: "True" location: row: 4 column: 3 @@ -47,8 +45,7 @@ expression: diagnostics row: 7 column: 18 fix: - content: - - "True" + content: "True" location: row: 7 column: 9 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index 12d4146417..6929dd0289 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 1 column: 14 fix: - content: - - "False" + content: "False" location: row: 1 column: 3 @@ -29,8 +28,7 @@ expression: diagnostics row: 4 column: 21 fix: - content: - - "False" + content: "False" location: row: 4 column: 3 @@ -47,8 +45,7 @@ expression: diagnostics row: 7 column: 20 fix: - content: - - "False" + content: "False" location: row: 7 column: 9 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM300_SIM300.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM300_SIM300.py.snap index 4a18cf0d00..0615dc3f13 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM300_SIM300.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM300_SIM300.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/flake8_simplify/mod.rs +source: crates/ruff/src/rules/flake8_simplify/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 2 column: 17 fix: - content: - - "compare == \"yoda\"" + content: "compare == \"yoda\"" location: row: 2 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 3 column: 17 fix: - content: - - "compare == \"yoda\"" + content: "compare == \"yoda\"" location: row: 3 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 4 column: 9 fix: - content: - - age == 42 + content: age == 42 location: row: 4 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 5 column: 21 fix: - content: - - "compare == (\"a\", \"b\")" + content: "compare == (\"a\", \"b\")" location: row: 5 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 6 column: 17 fix: - content: - - "compare >= \"yoda\"" + content: "compare >= \"yoda\"" location: row: 6 column: 0 @@ -107,8 +102,7 @@ expression: diagnostics row: 7 column: 16 fix: - content: - - "compare > \"yoda\"" + content: "compare > \"yoda\"" location: row: 7 column: 0 @@ -126,8 +120,7 @@ expression: diagnostics row: 8 column: 8 fix: - content: - - age < 42 + content: age < 42 location: row: 8 column: 0 @@ -145,8 +138,7 @@ expression: diagnostics row: 9 column: 11 fix: - content: - - age == YODA + content: age == YODA location: row: 9 column: 0 @@ -164,8 +156,7 @@ expression: diagnostics row: 10 column: 10 fix: - content: - - age < YODA + content: age < YODA location: row: 10 column: 0 @@ -183,8 +174,7 @@ expression: diagnostics row: 11 column: 11 fix: - content: - - age <= YODA + content: age <= YODA location: row: 11 column: 0 @@ -202,8 +192,7 @@ expression: diagnostics row: 12 column: 21 fix: - content: - - age == JediOrder.YODA + content: age == JediOrder.YODA location: row: 12 column: 0 @@ -221,8 +210,7 @@ expression: diagnostics row: 13 column: 18 fix: - content: - - (number - 100) > 0 + content: (number - 100) > 0 location: row: 13 column: 0 diff --git a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM401_SIM401.py.snap b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM401_SIM401.py.snap index e21b9bb25b..7213356f95 100644 --- a/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM401_SIM401.py.snap +++ b/crates/ruff/src/rules/flake8_simplify/snapshots/ruff__rules__flake8_simplify__tests__SIM401_SIM401.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 9 column: 20 fix: - content: - - "var = a_dict.get(key, \"default1\")" + content: "var = a_dict.get(key, \"default1\")" location: row: 6 column: 0 @@ -33,8 +32,7 @@ expression: diagnostics row: 15 column: 21 fix: - content: - - "var = a_dict.get(key, \"default2\")" + content: "var = a_dict.get(key, \"default2\")" location: row: 12 column: 0 @@ -53,8 +51,7 @@ expression: diagnostics row: 21 column: 21 fix: - content: - - "var = a_dict.get(key, val1 + val2)" + content: "var = a_dict.get(key, val1 + val2)" location: row: 18 column: 0 @@ -73,8 +70,7 @@ expression: diagnostics row: 27 column: 19 fix: - content: - - "var = a_dict.get(keys[idx], \"default\")" + content: "var = a_dict.get(keys[idx], \"default\")" location: row: 24 column: 0 @@ -93,8 +89,7 @@ expression: diagnostics row: 33 column: 19 fix: - content: - - "var = dicts[idx].get(key, \"default\")" + content: "var = dicts[idx].get(key, \"default\")" location: row: 30 column: 0 @@ -113,8 +108,7 @@ expression: diagnostics row: 39 column: 25 fix: - content: - - "vars[idx] = a_dict.get(key, \"default\")" + content: "vars[idx] = a_dict.get(key, \"default\")" location: row: 36 column: 0 diff --git a/crates/ruff/src/rules/flake8_tidy_imports/banned_api.rs b/crates/ruff/src/rules/flake8_tidy_imports/banned_api.rs index e9d316d0c1..c2e8999464 100644 --- a/crates/ruff/src/rules/flake8_tidy_imports/banned_api.rs +++ b/crates/ruff/src/rules/flake8_tidy_imports/banned_api.rs @@ -120,10 +120,10 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use rustc_hash::FxHashMap; use super::ApiBan; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_tidy_imports/relative_imports.rs b/crates/ruff/src/rules/flake8_tidy_imports/relative_imports.rs index 7d7b0b12dd..c95f66ef3e 100644 --- a/crates/ruff/src/rules/flake8_tidy_imports/relative_imports.rs +++ b/crates/ruff/src/rules/flake8_tidy_imports/relative_imports.rs @@ -185,8 +185,8 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/flake8_tidy_imports/snapshots/ruff__rules__flake8_tidy_imports__relative_imports__tests__ban_parent_imports_package.snap b/crates/ruff/src/rules/flake8_tidy_imports/snapshots/ruff__rules__flake8_tidy_imports__relative_imports__tests__ban_parent_imports_package.snap index a2fe3abe7e..72a2e1bad5 100644 --- a/crates/ruff/src/rules/flake8_tidy_imports/snapshots/ruff__rules__flake8_tidy_imports__relative_imports__tests__ban_parent_imports_package.snap +++ b/crates/ruff/src/rules/flake8_tidy_imports/snapshots/ruff__rules__flake8_tidy_imports__relative_imports__tests__ban_parent_imports_package.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 5 column: 55 fix: - content: - - "from my_package.sublib.protocol import commands, definitions, responses" + content: "from my_package.sublib.protocol import commands, definitions, responses" location: row: 5 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 5 column: 55 fix: - content: - - "from my_package.sublib.protocol import commands, definitions, responses" + content: "from my_package.sublib.protocol import commands, definitions, responses" location: row: 5 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 5 column: 55 fix: - content: - - "from my_package.sublib.protocol import commands, definitions, responses" + content: "from my_package.sublib.protocol import commands, definitions, responses" location: row: 5 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 6 column: 28 fix: - content: - - from my_package.sublib.server import example + content: from my_package.sublib.server import example location: row: 6 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 7 column: 21 fix: - content: - - from my_package.sublib.sublib import server + content: from my_package.sublib.sublib import server location: row: 7 column: 0 diff --git a/crates/ruff/src/rules/flake8_type_checking/mod.rs b/crates/ruff/src/rules/flake8_type_checking/mod.rs index cbe62cd523..d53a6ab9fb 100644 --- a/crates/ruff/src/rules/flake8_type_checking/mod.rs +++ b/crates/ruff/src/rules/flake8_type_checking/mod.rs @@ -9,11 +9,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::TypingOnlyFirstPartyImport, Path::new("TCH001.py"); "TCH001")] #[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("TCH002.py"); "TCH002")] diff --git a/crates/ruff/src/rules/flake8_type_checking/snapshots/ruff__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap b/crates/ruff/src/rules/flake8_type_checking/snapshots/ruff__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap index ef64f38451..dd87cebe77 100644 --- a/crates/ruff/src/rules/flake8_type_checking/snapshots/ruff__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap +++ b/crates/ruff/src/rules/flake8_type_checking/snapshots/ruff__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 8 fix: - content: - - "" + content: "" location: row: 3 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 8 column: 8 fix: - content: - - "" + content: "" location: row: 7 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 11 column: 8 fix: - content: - - "" + content: "" location: row: 10 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 16 column: 12 fix: - content: - - "" + content: "" location: row: 15 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 22 column: 12 fix: - content: - - "" + content: "" location: row: 21 column: 0 diff --git a/crates/ruff/src/rules/flake8_unused_arguments/mod.rs b/crates/ruff/src/rules/flake8_unused_arguments/mod.rs index e85e811d3f..4df309bc65 100644 --- a/crates/ruff/src/rules/flake8_unused_arguments/mod.rs +++ b/crates/ruff/src/rules/flake8_unused_arguments/mod.rs @@ -9,11 +9,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::UnusedFunctionArgument, Path::new("ARG.py"); "ARG001")] #[test_case(Rule::UnusedMethodArgument, Path::new("ARG.py"); "ARG002")] diff --git a/crates/ruff/src/rules/isort/mod.rs b/crates/ruff/src/rules/isort/mod.rs index 5195a75612..1089f6a6ae 100644 --- a/crates/ruff/src/rules/isort/mod.rs +++ b/crates/ruff/src/rules/isort/mod.rs @@ -334,11 +334,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use super::categorize::ImportType; use super::settings::RelativeImportsOrder; - use crate::assert_yaml_snapshot; + use crate::registry::Rule; use crate::settings::Settings; use crate::test::{test_path, test_resource_path}; diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__add_newline_before_comments.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__add_newline_before_comments.py.snap index 03d307b82b..6cd28a1320 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__add_newline_before_comments.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__add_newline_before_comments.py.snap @@ -11,18 +11,7 @@ expression: diagnostics row: 8 column: 0 fix: - content: - - import os - - "" - - "# This is a comment in the same section, so we need to add one newline." - - import sys - - "" - - import numpy as np - - "" - - "# This is a comment, but it starts a new section, so we don't need to add a newline" - - "# before it." - - import leading_prefix - - "" + content: "import os\n\n# This is a comment in the same section, so we need to add one newline.\nimport sys\n\nimport numpy as np\n\n# This is a comment, but it starts a new section, so we don't need to add a newline\n# before it.\nimport leading_prefix\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap index 3f31c7187a..07e573e438 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 4 column: 0 fix: - content: - - from . import c - - from .. import b - - from ... import a - - "" + content: "from . import c\nfrom .. import b\nfrom ... import a\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports.py.snap index 3eebedb3a1..5e6448b3c1 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - "from module import CONSTANT, function" - - from module import Class as C - - from module import function as f - - "" + content: "from module import CONSTANT, function\nfrom module import Class as C\nfrom module import function as f\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap index a9b87731bf..6a07eca41b 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - "from module import CONSTANT, Class as C, function, function as f" - - "" + content: "from module import CONSTANT, Class as C, function, function as f\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_import_from.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_import_from.py.snap index f24b790833..52ec728dec 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_import_from.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combine_import_from.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,16 +11,7 @@ expression: diagnostics row: 6 column: 0 fix: - content: - - from collections import ( - - " AsyncIterable," - - " Awaitable," - - " ChainMap," - - " Collection," - - " MutableMapping," - - " MutableSequence," - - ) - - "" + content: "from collections import (\n AsyncIterable,\n Awaitable,\n ChainMap,\n Collection,\n MutableMapping,\n MutableSequence,\n)\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combined_required_imports_docstring.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combined_required_imports_docstring.py.snap index dac153abe9..6b9ad51085 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combined_required_imports_docstring.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__combined_required_imports_docstring.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - from __future__ import annotations + content: "\nfrom __future__ import annotations" location: row: 1 column: 19 @@ -30,9 +28,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - from __future__ import generator_stop + content: "\nfrom __future__ import generator_stop" location: row: 1 column: 19 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__comments.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__comments.py.snap index 7bc7f33315..627d9a03c6 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__comments.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__comments.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,31 +11,7 @@ expression: diagnostics row: 34 column: 0 fix: - content: - - "import B # Comment 4" - - "" - - "# Comment 3a" - - "# Comment 3b" - - import C - - import D - - "" - - "# Comment 5" - - "# Comment 6" - - from A import ( - - " a, # Comment 7 # Comment 9" - - " b, # Comment 10" - - " c, # Comment 8 # Comment 11" - - ) - - from D import ( - - " a_long_name_to_force_multiple_lines, # Comment 12" - - " another_long_name_to_force_multiple_lines, # Comment 13" - - ) - - "from E import a # Comment 1" - - from F import ( - - " a, # Comment 1" - - " b," - - ) - - "" + content: "import B # Comment 4\n\n# Comment 3a\n# Comment 3b\nimport C\nimport D\n\n# Comment 5\n# Comment 6\nfrom A import (\n a, # Comment 7 # Comment 9\n b, # Comment 10\n c, # Comment 8 # Comment 11\n)\nfrom D import (\n a_long_name_to_force_multiple_lines, # Comment 12\n another_long_name_to_force_multiple_lines, # Comment 13\n)\nfrom E import a # Comment 1\nfrom F import (\n a, # Comment 1\n b,\n)\n" location: row: 3 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__deduplicate_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__deduplicate_imports.py.snap index e73d6f3e33..3969511bf7 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__deduplicate_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__deduplicate_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - import os - - import os as os1 - - import os as os2 - - "" + content: "import os\nimport os as os1\nimport os as os2\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length.py.snap index f0c3af955b..e7977fa9ea 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,24 +11,7 @@ expression: diagnostics row: 15 column: 0 fix: - content: - - " from line_with_88 import aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - - " from line_with_89 import (" - - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa," - - " )" - - " from line_with_90 import (" - - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa," - - " )" - - " from line_with_91 import (" - - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa," - - " )" - - " from line_with_92 import (" - - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa," - - " )" - - " from line_with_93 import (" - - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa," - - " )" - - "" + content: " from line_with_88 import aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n from line_with_89 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_90 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_91 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_92 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_93 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n" location: row: 7 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length_comment.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length_comment.py.snap index 964298be32..a02b44f1d1 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length_comment.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__fit_line_length_comment.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,15 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - import a - - "" - - "# Don't take this comment into account when determining whether the next import can fit on one line." - - from b import c - - from d import ( - - " e, # Do take this comment into account when determining whether the next import can fit on one line." - - ) - - "" + content: "import a\n\n# Don't take this comment into account when determining whether the next import can fit on one line.\nfrom b import c\nfrom d import (\n e, # Do take this comment into account when determining whether the next import can fit on one line.\n)\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap index fa58eb4e60..852f462410 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,28 +11,7 @@ expression: diagnostics row: 19 column: 0 fix: - content: - - import math - - import sys - - "from logging.handlers import FileHandler, StreamHandler" - - "from os import path, uname" - - "" - - "# comment 5" - - "from bar import a # comment 6" - - "from bar import b # comment 7" - - "from foo import bar # comment 3" - - "from foo2 import bar2 # comment 4" - - "" - - "# comment 1" - - "# comment 2" - - from third_party import lib1 - - from third_party import lib2 - - from third_party import lib3 - - from third_party import lib4 - - from third_party import lib5 - - from third_party import lib6 - - from third_party import lib7 - - "" + content: "import math\nimport sys\nfrom logging.handlers import FileHandler, StreamHandler\nfrom os import path, uname\n\n# comment 5\nfrom bar import a # comment 6\nfrom bar import b # comment 7\nfrom foo import bar # comment 3\nfrom foo2 import bar2 # comment 4\n\n# comment 1\n# comment 2\nfrom third_party import lib1\nfrom third_party import lib2\nfrom third_party import lib3\nfrom third_party import lib4\nfrom third_party import lib5\nfrom third_party import lib6\nfrom third_party import lib7\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections.py.snap index c0c5c59c0b..70944eca21 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,19 +11,7 @@ expression: diagnostics row: 12 column: 0 fix: - content: - - "import a # import" - - "import b as b1 # import_as" - - import c.d - - "from a import a1 # import_from" - - "from c import * # import_from_star" - - "" - - from ...grandparent import fn3 - - from ..parent import * - - from . import my - - from .my import fn - - from .my.nested import fn2 - - "" + content: "import a # import\nimport b as b1 # import_as\nimport c.d\nfrom a import a1 # import_from\nfrom c import * # import_from_star\n\nfrom ...grandparent import fn3\nfrom ..parent import *\nfrom . import my\nfrom .my import fn\nfrom .my.nested import fn2\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap index 354c422493..2f33a480ed 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,19 +11,7 @@ expression: diagnostics row: 12 column: 0 fix: - content: - - "import a # import" - - "from a import a1 # import_from" - - "import b as b1 # import_as" - - "from c import * # import_from_star" - - import c.d - - "" - - from ...grandparent import fn3 - - from ..parent import * - - from . import my - - from .my import fn - - from .my.nested import fn2 - - "" + content: "import a # import\nfrom a import a1 # import_from\nimport b as b1 # import_as\nfrom c import * # import_from_star\nimport c.d\n\nfrom ...grandparent import fn3\nfrom ..parent import *\nfrom . import my\nfrom .my import fn\nfrom .my.nested import fn2\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top.py.snap index 88c1590976..be80bdaa65 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top.py.snap @@ -11,27 +11,7 @@ expression: diagnostics row: 24 column: 0 fix: - content: - - import foo - - import lib1 - - import lib2 - - import lib3 - - import lib3.lib4 - - import lib3.lib4.lib5 - - import lib4 - - import lib5 - - import lib6 - - import z - - from foo import bar - - from foo.lib1.bar import baz - - from lib1 import foo - - from lib1.lib2 import foo - - from lib2 import foo - - from lib3.lib4 import foo - - from lib3.lib4.lib5 import foo - - "from lib4 import lib1, lib2" - - "from lib5 import lib1, lib2" - - "" + content: "import foo\nimport lib1\nimport lib2\nimport lib3\nimport lib3.lib4\nimport lib3.lib4.lib5\nimport lib4\nimport lib5\nimport lib6\nimport z\nfrom foo import bar\nfrom foo.lib1.bar import baz\nfrom lib1 import foo\nfrom lib1.lib2 import foo\nfrom lib2 import foo\nfrom lib3.lib4 import foo\nfrom lib3.lib4.lib5 import foo\nfrom lib4 import lib1, lib2\nfrom lib5 import lib1, lib2\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top_force_to_top.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top_force_to_top.py.snap index f3af1bcfcd..1032522157 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top_force_to_top.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_to_top_force_to_top.py.snap @@ -11,27 +11,7 @@ expression: diagnostics row: 24 column: 0 fix: - content: - - import lib1 - - import lib3 - - import lib3.lib4 - - import lib5 - - import z - - import foo - - import lib2 - - import lib3.lib4.lib5 - - import lib4 - - import lib6 - - from lib1 import foo - - from lib3.lib4 import foo - - "from lib5 import lib1, lib2" - - from foo import bar - - from foo.lib1.bar import baz - - from lib1.lib2 import foo - - from lib2 import foo - - from lib3.lib4.lib5 import foo - - "from lib4 import lib1, lib2" - - "" + content: "import lib1\nimport lib3\nimport lib3.lib4\nimport lib5\nimport z\nimport foo\nimport lib2\nimport lib3.lib4.lib5\nimport lib4\nimport lib6\nfrom lib1 import foo\nfrom lib3.lib4 import foo\nfrom lib5 import lib1, lib2\nfrom foo import bar\nfrom foo.lib1.bar import baz\nfrom lib1.lib2 import foo\nfrom lib2 import foo\nfrom lib3.lib4.lib5 import foo\nfrom lib4 import lib1, lib2\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases.py.snap index e2f481ca45..a059d60d49 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,12 +11,7 @@ expression: diagnostics row: 4 column: 0 fix: - content: - - from .a import a1 as a1 - - from .a import a2 as a2 - - from .b import b1 as b1 - - from .c import c1 - - "" + content: "from .a import a1 as a1\nfrom .a import a2 as a2\nfrom .b import b1 as b1\nfrom .c import c1\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap index 4be4daeb82..7a43c7a208 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,14 +11,7 @@ expression: diagnostics row: 4 column: 0 fix: - content: - - from .a import ( - - " a1 as a1," - - " a2 as a2," - - ) - - from .b import b1 as b1 - - from .c import c1 - - "" + content: "from .a import (\n a1 as a1,\n a2 as a2,\n)\nfrom .b import b1 as b1\nfrom .c import c1\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__forced_separate.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__forced_separate.py.snap index 590b3cb252..4211946b75 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__forced_separate.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__forced_separate.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,16 +11,7 @@ expression: diagnostics row: 9 column: 0 fix: - content: - - from office_helper.assistants import entity_registry as er - - from office_helper.core import CoreState - - "" - - import tests.common.foo as tcf - - from tests.common import async_mock_service - - "" - - from experiments.starry import * - - from experiments.weird import varieties - - "" + content: "from office_helper.assistants import entity_registry as er\nfrom office_helper.core import CoreState\n\nimport tests.common.foo as tcf\nfrom tests.common import async_mock_service\n\nfrom experiments.starry import *\nfrom experiments.weird import varieties\n" location: row: 3 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__import_from_after_import.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__import_from_after_import.py.snap index 3d02ed3c9b..fd85ecdbcd 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__import_from_after_import.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__import_from_after_import.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,10 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - import os - - from collections import Collection - - "" + content: "import os\nfrom collections import Collection\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__inline_comments.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__inline_comments.py.snap index 35d5bbc4ea..d3c9c09859 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__inline_comments.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__inline_comments.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,21 +11,7 @@ expression: diagnostics row: 12 column: 0 fix: - content: - - "from a.prometheus.metrics import ( # type:ignore[attr-defined]" - - " TERMINAL_CURRENTLY_RUNNING_TOTAL," - - ) - - from b.prometheus.metrics import ( - - " TERMINAL_CURRENTLY_RUNNING_TOTAL, # type:ignore[attr-defined]" - - ) - - from c.prometheus.metrics import ( - - " TERMINAL_CURRENTLY_RUNNING_TOTAL, # type:ignore[attr-defined]" - - ) - - "from d.prometheus.metrics import ( # type:ignore[attr-defined]" - - " OTHER_RUNNING_TOTAL," - - " TERMINAL_CURRENTLY_RUNNING_TOTAL," - - ) - - "" + content: "from a.prometheus.metrics import ( # type:ignore[attr-defined]\n TERMINAL_CURRENTLY_RUNNING_TOTAL,\n)\nfrom b.prometheus.metrics import (\n TERMINAL_CURRENTLY_RUNNING_TOTAL, # type:ignore[attr-defined]\n)\nfrom c.prometheus.metrics import (\n TERMINAL_CURRENTLY_RUNNING_TOTAL, # type:ignore[attr-defined]\n)\nfrom d.prometheus.metrics import ( # type:ignore[attr-defined]\n OTHER_RUNNING_TOTAL,\n TERMINAL_CURRENTLY_RUNNING_TOTAL,\n)\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.py.snap index 78f5ce086d..4993e3e8ff 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - import a - - import b - - "" - - "" + content: "import a\nimport b\n\n" location: row: 1 column: 0 @@ -32,12 +28,7 @@ expression: diagnostics row: 6 column: 0 fix: - content: - - import os - - import sys - - "" - - "" - - "" + content: "import os\nimport sys\n\n\n" location: row: 4 column: 0 @@ -54,11 +45,7 @@ expression: diagnostics row: 16 column: 0 fix: - content: - - import os - - import sys - - "" - - "" + content: "import os\nimport sys\n\n" location: row: 14 column: 0 @@ -75,11 +62,7 @@ expression: diagnostics row: 54 column: 0 fix: - content: - - import os - - "" - - "" - - "" + content: "import os\n\n\n" location: row: 52 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.pyi.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.pyi.snap index 9e90c00ec6..df03e36317 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.pyi.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__insert_empty_lines.pyi.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - import a - - import b - - "" - - "" + content: "import a\nimport b\n\n" location: row: 1 column: 0 @@ -32,11 +28,7 @@ expression: diagnostics row: 6 column: 0 fix: - content: - - import os - - import sys - - "" - - "" + content: "import os\nimport sys\n\n" location: row: 4 column: 0 @@ -53,11 +45,7 @@ expression: diagnostics row: 16 column: 0 fix: - content: - - import os - - import sys - - "" - - "" + content: "import os\nimport sys\n\n" location: row: 14 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap index b52f958f60..cb3166b311 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap @@ -11,15 +11,7 @@ expression: diagnostics row: 6 column: 0 fix: - content: - - import os - - import sys - - "" - - import leading_prefix - - "" - - import ruff - - from . import leading_prefix - - "" + content: "import os\nimport sys\n\nimport leading_prefix\n\nimport ruff\nfrom . import leading_prefix\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap index 0fa9e64492..a224584c0e 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,19 +11,7 @@ expression: diagnostics row: 10 column: 0 fix: - content: - - from __future__ import annotations - - "" - - from typing import Any - - "" - - from my_first_party import my_first_party_object - - from requests import Session - - "" - - from . import my_local_folder_object - - "" - - "" - - "" - - "" + content: "from __future__ import annotations\n\nfrom typing import Any\n\nfrom my_first_party import my_first_party_object\nfrom requests import Session\n\nfrom . import my_local_folder_object\n\n\n\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap index ff6d5535f2..d868acc23c 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,19 +11,7 @@ expression: diagnostics row: 21 column: 0 fix: - content: - - from __future__ import annotations - - "" - - from typing import Any - - "" - - from my_first_party import my_first_party_object - - from requests import Session - - "" - - from . import my_local_folder_object - - "" - - "" - - "" - - "" + content: "from __future__ import annotations\n\nfrom typing import Any\n\nfrom my_first_party import my_first_party_object\nfrom requests import Session\n\nfrom . import my_local_folder_object\n\n\n\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap index e3faea75f7..29794d3946 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,16 +11,7 @@ expression: diagnostics row: 10 column: 0 fix: - content: - - from __future__ import annotations - - "" - - from typing import Any - - "" - - from my_first_party import my_first_party_object - - from requests import Session - - "" - - from . import my_local_folder_object - - "" + content: "from __future__ import annotations\n\nfrom typing import Any\n\nfrom my_first_party import my_first_party_object\nfrom requests import Session\n\nfrom . import my_local_folder_object\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_between_typeslines_between_types.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_between_typeslines_between_types.py.snap index be0f623d9b..363cacf044 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_between_typeslines_between_types.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__lines_between_typeslines_between_types.py.snap @@ -11,24 +11,7 @@ expression: diagnostics row: 17 column: 0 fix: - content: - - from __future__ import annotations - - "" - - import datetime - - import json - - "" - - "" - - from binascii import hexlify - - "" - - import requests - - "" - - "" - - from loguru import Logger - - from sanic import Sanic - - "" - - from . import config - - from .data import Data - - "" + content: "from __future__ import annotations\n\nimport datetime\nimport json\n\n\nfrom binascii import hexlify\n\nimport requests\n\n\nfrom loguru import Logger\nfrom sanic import Sanic\n\nfrom . import config\nfrom .data import Data\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__magic_trailing_comma.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__magic_trailing_comma.py.snap index 771d25e126..0f58a62501 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__magic_trailing_comma.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__magic_trailing_comma.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,39 +11,7 @@ expression: diagnostics row: 39 column: 0 fix: - content: - - from glob import ( - - " escape, # Ends with a comment, should still treat as magic trailing comma." - - " glob," - - " iglob," - - ) - - "" - - "# No magic comma, this will be rolled into one line." - - "from os import environ, execl, execv, path" - - from sys import ( - - " argv," - - " exit," - - " stderr," - - " stdout," - - ) - - "" - - "# These will be combined, but without a trailing comma." - - "from foo import bar, baz" - - "" - - "# These will be combined, _with_ a trailing comma." - - from module1 import ( - - " member1," - - " member2," - - " member3," - - ) - - "" - - "# These will be combined, _with_ a trailing comma." - - from module2 import ( - - " member1," - - " member2," - - " member3," - - ) - - "" + content: "from glob import (\n escape, # Ends with a comment, should still treat as magic trailing comma.\n glob,\n iglob,\n)\n\n# No magic comma, this will be rolled into one line.\nfrom os import environ, execl, execv, path\nfrom sys import (\n argv,\n exit,\n stderr,\n stdout,\n)\n\n# These will be combined, but without a trailing comma.\nfrom foo import bar, baz\n\n# These will be combined, _with_ a trailing comma.\nfrom module1 import (\n member1,\n member2,\n member3,\n)\n\n# These will be combined, _with_ a trailing comma.\nfrom module2 import (\n member1,\n member2,\n member3,\n)\n" location: row: 2 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__natural_order.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__natural_order.py.snap index 73a0fb1b95..9d55bfab7c 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__natural_order.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__natural_order.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,24 +11,7 @@ expression: diagnostics row: 17 column: 0 fix: - content: - - import numpy1 - - import numpy2 - - import numpy10 - - from numpy import ( - - " cos," - - " int8," - - " int16," - - " int32," - - " int64," - - " sin," - - " tan," - - " uint8," - - " uint16," - - " uint32," - - " uint64," - - ) - - "" + content: "import numpy1\nimport numpy2\nimport numpy10\nfrom numpy import (\n cos,\n int8,\n int16,\n int32,\n int64,\n sin,\n tan,\n uint8,\n uint16,\n uint32,\n uint64,\n)\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py.snap index e3faea75f7..29794d3946 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,16 +11,7 @@ expression: diagnostics row: 10 column: 0 fix: - content: - - from __future__ import annotations - - "" - - from typing import Any - - "" - - from my_first_party import my_first_party_object - - from requests import Session - - "" - - from . import my_local_folder_object - - "" + content: "from __future__ import annotations\n\nfrom typing import Any\n\nfrom my_first_party import my_first_party_object\nfrom requests import Session\n\nfrom . import my_local_folder_object\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap index 7e86288d70..2a07a22abb 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,13 +11,7 @@ expression: diagnostics row: 10 column: 0 fix: - content: - - from __future__ import annotations - - from typing import Any - - from my_first_party import my_first_party_object - - from requests import Session - - from . import my_local_folder_object - - "" + content: "from __future__ import annotations\nfrom typing import Any\nfrom my_first_party import my_first_party_object\nfrom requests import Session\nfrom . import my_local_folder_object\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_wrap_star.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_wrap_star.py.snap index bc2c7e80ec..a139b135e1 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_wrap_star.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__no_wrap_star.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 2 column: 0 fix: - content: - - "from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore" - - "" + content: "from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type.py.snap index eadd770f69..90657459c8 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,21 +11,7 @@ expression: diagnostics row: 13 column: 0 fix: - content: - - import glob - - import os - - import shutil - - import tempfile - - import time - - "from subprocess import PIPE, STDOUT, Popen" - - "" - - import BAR - - import bar - - import FOO - - import foo - - import StringIO - - "from module import BASIC, CONSTANT, Apple, Class, function" - - "" + content: "import glob\nimport os\nimport shutil\nimport tempfile\nimport time\nfrom subprocess import PIPE, STDOUT, Popen\n\nimport BAR\nimport bar\nimport FOO\nimport foo\nimport StringIO\nfrom module import BASIC, CONSTANT, Apple, Class, function\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_false_order_by_type.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_false_order_by_type.py.snap index 2216350fc0..1acbe697fa 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_false_order_by_type.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_false_order_by_type.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,21 +11,7 @@ expression: diagnostics row: 13 column: 0 fix: - content: - - import glob - - import os - - import shutil - - import tempfile - - import time - - "from subprocess import PIPE, Popen, STDOUT" - - "" - - import BAR - - import bar - - import FOO - - import foo - - import StringIO - - "from module import Apple, BASIC, Class, CONSTANT, function" - - "" + content: "import glob\nimport os\nimport shutil\nimport tempfile\nimport time\nfrom subprocess import PIPE, Popen, STDOUT\n\nimport BAR\nimport bar\nimport FOO\nimport foo\nimport StringIO\nfrom module import Apple, BASIC, Class, CONSTANT, function\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes.py.snap index f543a2a14b..fc71e49a11 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,13 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - "from subprocess import N_CLASS, PIPE, STDOUT, Popen" - - "" - - "from module import BASIC, CLASS, CONSTANT, Apple, Class, function" - - "from sklearn.svm import CONST, SVC, Klass, func" - - "from torch.nn import A_CONSTANT, SELU, AClass" - - "" + content: "from subprocess import N_CLASS, PIPE, STDOUT, Popen\n\nfrom module import BASIC, CLASS, CONSTANT, Apple, Class, function\nfrom sklearn.svm import CONST, SVC, Klass, func\nfrom torch.nn import A_CONSTANT, SELU, AClass\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap index 98e3c85c69..212e36d9c9 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,13 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - "from subprocess import PIPE, STDOUT, N_CLASS, Popen" - - "" - - "from module import BASIC, CONSTANT, Apple, CLASS, Class, function" - - "from sklearn.svm import CONST, Klass, SVC, func" - - "from torch.nn import A_CONSTANT, AClass, SELU" - - "" + content: "from subprocess import PIPE, STDOUT, N_CLASS, Popen\n\nfrom module import BASIC, CONSTANT, Apple, CLASS, Class, function\nfrom sklearn.svm import CONST, Klass, SVC, func\nfrom torch.nn import A_CONSTANT, AClass, SELU\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants.py.snap index 0243071268..2c0d46a169 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - "from subprocess import STDOUT, A_constant, Class, First, Last, func, konst, var" - - "" - - "from sklearn.svm import XYZ, Const, Klass, constant, func, variable" - - "" + content: "from subprocess import STDOUT, A_constant, Class, First, Last, func, konst, var\n\nfrom sklearn.svm import XYZ, Const, Klass, constant, func, variable\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap index 3006086936..a1ef2118c2 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - "from subprocess import A_constant, First, konst, Last, STDOUT, Class, func, var" - - "" - - "from sklearn.svm import Const, constant, XYZ, Klass, func, variable" - - "" + content: "from subprocess import A_constant, First, konst, Last, STDOUT, Class, func, var\n\nfrom sklearn.svm import Const, constant, XYZ, Klass, func, variable\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables.py.snap index e8dcb8ff08..d2f72fc42a 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - "from subprocess import CONSTANT, Klass, Variable, exe, utils, var_ABC" - - "" - - "from sklearn.svm import CONST, VAR, Class, MyVar, abc" - - "" + content: "from subprocess import CONSTANT, Klass, Variable, exe, utils, var_ABC\n\nfrom sklearn.svm import CONST, VAR, Class, MyVar, abc\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap index 653a7bf2ed..36e807c289 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - "from subprocess import CONSTANT, Klass, exe, utils, var_ABC, Variable" - - "" - - "from sklearn.svm import CONST, Class, abc, MyVar, VAR" - - "" + content: "from subprocess import CONSTANT, Klass, exe, utils, var_ABC, Variable\n\nfrom sklearn.svm import CONST, Class, abc, MyVar, VAR\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_relative_imports_by_level.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_relative_imports_by_level.py.snap index 7384da7f47..852ae2918f 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_relative_imports_by_level.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__order_relative_imports_by_level.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,12 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - from ..a import a - - from ..b import a - - from .a import a - - from .b import a - - "" + content: "from ..a import a\nfrom ..b import a\nfrom .a import a\nfrom .b import a\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_comment_order.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_comment_order.py.snap index 7a0176786a..3e14b9dc4a 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_comment_order.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_comment_order.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,20 +11,7 @@ expression: diagnostics row: 12 column: 0 fix: - content: - - import abc - - import io - - "" - - "# Old MacDonald had a farm," - - "# EIEIO" - - "# And on his farm he had a cow," - - "# EIEIO" - - "# With a moo-moo here and a moo-moo there" - - "# Here a moo, there a moo, everywhere moo-moo" - - "# Old MacDonald had a farm," - - "# EIEIO" - - from errno import EIO - - "" + content: "import abc\nimport io\n\n# Old MacDonald had a farm,\n# EIEIO\n# And on his farm he had a cow,\n# EIEIO\n# With a moo-moo here and a moo-moo there\n# Here a moo, there a moo, everywhere moo-moo\n# Old MacDonald had a farm,\n# EIEIO\nfrom errno import EIO\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_import_star.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_import_star.py.snap index cff0d5e029..c3b786dbba 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_import_star.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_import_star.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,15 +11,7 @@ expression: diagnostics row: 7 column: 0 fix: - content: - - "# Above" - - "from some_module import * # Aside" - - "" - - "# Above" - - "from some_module import some_class # Aside" - - from some_other_module import * - - from some_other_module import some_class - - "" + content: "# Above\nfrom some_module import * # Aside\n\n# Above\nfrom some_module import some_class # Aside\nfrom some_other_module import *\nfrom some_other_module import some_class\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_indentation.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_indentation.py.snap index d319f129da..907ff8a5cd 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_indentation.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__preserve_indentation.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,10 +11,7 @@ expression: diagnostics row: 4 column: 0 fix: - content: - - " import os" - - " import sys" - - "" + content: " import os\n import sys\n" location: row: 2 column: 0 @@ -31,10 +28,7 @@ expression: diagnostics row: 7 column: 0 fix: - content: - - " import os" - - " import sys" - - "" + content: " import os\n import sys\n" location: row: 5 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__reorder_within_section.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__reorder_within_section.py.snap index 12c0e22ce5..0e4ceb95be 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__reorder_within_section.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__reorder_within_section.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,10 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - import os - - import sys - - "" + content: "import os\nimport sys\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_docstring.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_docstring.py.snap index afe35c4ccf..705a19d977 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_docstring.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_docstring.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - from __future__ import annotations + content: "\nfrom __future__ import annotations" location: row: 1 column: 19 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_multiline_docstring.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_multiline_docstring.py.snap index 77ea497dff..313ea8a927 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_multiline_docstring.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_import_multiline_docstring.py.snap @@ -11,9 +11,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - from __future__ import annotations + content: "\nfrom __future__ import annotations" location: row: 3 column: 3 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_imports_docstring.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_imports_docstring.py.snap index dac153abe9..6b9ad51085 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_imports_docstring.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__required_imports_docstring.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - from __future__ import annotations + content: "\nfrom __future__ import annotations" location: row: 1 column: 19 @@ -30,9 +28,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - from __future__ import generator_stop + content: "\nfrom __future__ import generator_stop" location: row: 1 column: 19 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_first_party_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_first_party_imports.py.snap index 98e7bcb45d..a7a6e2494c 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_first_party_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_first_party_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,15 +11,7 @@ expression: diagnostics row: 6 column: 0 fix: - content: - - import os - - import sys - - "" - - import numpy as np - - "" - - import leading_prefix - - from leading_prefix import Class - - "" + content: "import os\nimport sys\n\nimport numpy as np\n\nimport leading_prefix\nfrom leading_prefix import Class\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_future_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_future_imports.py.snap index e9fba6c5cb..ad6cbfab76 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_future_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_future_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,12 +11,7 @@ expression: diagnostics row: 4 column: 0 fix: - content: - - from __future__ import annotations - - "" - - import os - - import sys - - "" + content: "from __future__ import annotations\n\nimport os\nimport sys\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_local_folder_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_local_folder_imports.py.snap index 84640d04e3..dbd110d472 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_local_folder_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_local_folder_imports.py.snap @@ -11,16 +11,7 @@ expression: diagnostics row: 6 column: 0 fix: - content: - - import os - - import sys - - "" - - import ruff - - "" - - import leading_prefix - - "" - - from . import leading_prefix - - "" + content: "import os\nimport sys\n\nimport ruff\n\nimport leading_prefix\n\nfrom . import leading_prefix\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_third_party_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_third_party_imports.py.snap index 354679c89c..a893e93551 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_third_party_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__separate_third_party_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,13 +11,7 @@ expression: diagnostics row: 5 column: 0 fix: - content: - - import os - - import sys - - "" - - import numpy as np - - import pandas as pd - - "" + content: "import os\nimport sys\n\nimport numpy as np\nimport pandas as pd\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__skip.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__skip.py.snap index 1175cea457..8fb4c6d4c6 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__skip.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__skip.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,10 +11,7 @@ expression: diagnostics row: 14 column: 0 fix: - content: - - " import abc" - - " import collections" - - "" + content: " import abc\n import collections\n" location: row: 12 column: 0 @@ -31,10 +28,7 @@ expression: diagnostics row: 21 column: 0 fix: - content: - - " import abc" - - " import collections" - - "" + content: " import abc\n import collections\n" location: row: 19 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__sort_similar_imports.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__sort_similar_imports.py.snap index 0ca46a60fe..921b70a364 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__sort_similar_imports.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__sort_similar_imports.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,30 +11,7 @@ expression: diagnostics row: 27 column: 0 fix: - content: - - import A - - import a - - import B - - import b - - import x - - import x as A - - import x as Y - - import x as a - - import x as y - - from a import BAD as DEF - - "from a import B, b" - - from a import B as A - - from a import B as Abc - - from a import B as DEF - - from a import Boo as DEF - - from a import b as a - - from a import b as c - - from a import b as d - - from a import b as x - - from a import b as y - - "from b import C, c" - - from b import c as d - - "" + content: "import A\nimport a\nimport B\nimport b\nimport x\nimport x as A\nimport x as Y\nimport x as a\nimport x as y\nfrom a import BAD as DEF\nfrom a import B, b\nfrom a import B as A\nfrom a import B as Abc\nfrom a import B as DEF\nfrom a import Boo as DEF\nfrom a import b as a\nfrom a import b as c\nfrom a import b as d\nfrom a import b as x\nfrom a import b as y\nfrom b import C, c\nfrom b import c as d\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap index 231200849d..7f73183d61 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,26 +11,7 @@ expression: diagnostics row: 39 column: 0 fix: - content: - - from glob import ( - - " escape, # Ends with a comment, should still treat as magic trailing comma." - - " glob," - - " iglob," - - ) - - "" - - "# No magic comma, this will be rolled into one line." - - "from os import environ, execl, execv, path" - - "from sys import argv, exit, stderr, stdout" - - "" - - "# These will be combined, but without a trailing comma." - - "from foo import bar, baz" - - "" - - "# These will be combined, _with_ a trailing comma." - - "from module1 import member1, member2, member3" - - "" - - "# These will be combined, _with_ a trailing comma." - - "from module2 import member1, member2, member3" - - "" + content: "from glob import (\n escape, # Ends with a comment, should still treat as magic trailing comma.\n glob,\n iglob,\n)\n\n# No magic comma, this will be rolled into one line.\nfrom os import environ, execl, execv, path\nfrom sys import argv, exit, stderr, stdout\n\n# These will be combined, but without a trailing comma.\nfrom foo import bar, baz\n\n# These will be combined, _with_ a trailing comma.\nfrom module1 import member1, member2, member3\n\n# These will be combined, _with_ a trailing comma.\nfrom module2 import member1, member2, member3\n" location: row: 2 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__star_before_others.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__star_before_others.py.snap index 98568403ec..8c5e5113f1 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__star_before_others.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__star_before_others.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,11 +11,7 @@ expression: diagnostics row: 4 column: 0 fix: - content: - - from .logging import config_logging - - from .settings import * - - from .settings import ENV - - "" + content: "from .logging import config_logging\nfrom .settings import *\nfrom .settings import ENV\n" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__straight_required_import_docstring.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__straight_required_import_docstring.py.snap index badaf54830..3ce497f891 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__straight_required_import_docstring.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__straight_required_import_docstring.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/isort/mod.rs +source: crates/ruff/src/rules/isort/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 1 column: 0 fix: - content: - - "" - - import os + content: "\nimport os" location: row: 1 column: 19 diff --git a/crates/ruff/src/rules/mccabe/mod.rs b/crates/ruff/src/rules/mccabe/mod.rs index 6929440d0d..b90d1f816d 100644 --- a/crates/ruff/src/rules/mccabe/mod.rs +++ b/crates/ruff/src/rules/mccabe/mod.rs @@ -7,9 +7,9 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::settings::Settings; use crate::test::test_path; diff --git a/crates/ruff/src/rules/numpy/mod.rs b/crates/ruff/src/rules/numpy/mod.rs index b1a37eed85..99b4dfe80a 100644 --- a/crates/ruff/src/rules/numpy/mod.rs +++ b/crates/ruff/src/rules/numpy/mod.rs @@ -7,11 +7,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::NumpyDeprecatedTypeAlias, Path::new("NPY001.py"); "NPY001")] #[test_case(Rule::NumpyLegacyRandom, Path::new("NPY002.py"); "NPY002")] diff --git a/crates/ruff/src/rules/numpy/snapshots/ruff__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap b/crates/ruff/src/rules/numpy/snapshots/ruff__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap index 86361f6253..d1fd8c6b93 100644 --- a/crates/ruff/src/rules/numpy/snapshots/ruff__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap +++ b/crates/ruff/src/rules/numpy/snapshots/ruff__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 6 column: 8 fix: - content: - - bool + content: bool location: row: 6 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 7 column: 7 fix: - content: - - int + content: int location: row: 7 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 9 column: 21 fix: - content: - - object + content: object location: row: 9 column: 12 @@ -69,8 +66,7 @@ expression: diagnostics row: 12 column: 77 fix: - content: - - int + content: int location: row: 12 column: 71 @@ -88,8 +84,7 @@ expression: diagnostics row: 12 column: 86 fix: - content: - - int + content: int location: row: 12 column: 79 @@ -107,8 +102,7 @@ expression: diagnostics row: 17 column: 22 fix: - content: - - object + content: object location: row: 17 column: 10 @@ -126,8 +120,7 @@ expression: diagnostics row: 20 column: 21 fix: - content: - - int + content: int location: row: 20 column: 15 diff --git a/crates/ruff/src/rules/pandas_vet/mod.rs b/crates/ruff/src/rules/pandas_vet/mod.rs index ae35afaaa1..7de30c7043 100644 --- a/crates/ruff/src/rules/pandas_vet/mod.rs +++ b/crates/ruff/src/rules/pandas_vet/mod.rs @@ -8,6 +8,7 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use rustpython_parser::lexer::LexResult; use test_case::test_case; use textwrap::dedent; @@ -17,7 +18,7 @@ mod tests { use crate::settings::flags; use crate::source_code::{Indexer, Locator, Stylist}; use crate::test::test_path; - use crate::{assert_yaml_snapshot, directives, rustpython_helpers, settings}; + use crate::{directives, rustpython_helpers, settings}; fn rule_code(contents: &str, expected: &[Rule]) { let contents = dedent(contents); diff --git a/crates/ruff/src/rules/pandas_vet/snapshots/ruff__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff/src/rules/pandas_vet/snapshots/ruff__rules__pandas_vet__tests__PD002_PD002.py.snap index 7d57df722e..0037b6ad6d 100644 --- a/crates/ruff/src/rules/pandas_vet/snapshots/ruff__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff/src/rules/pandas_vet/snapshots/ruff__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pandas_vet/mod.rs +source: crates/ruff/src/rules/pandas_vet/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 5 column: 34 fix: - content: - - "x = x.drop([\"a\"], axis=1)" + content: "x = x.drop([\"a\"], axis=1)" location: row: 5 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 34 fix: - content: - - "x = x.drop([\"a\"], axis=1)" + content: "x = x.drop([\"a\"], axis=1)" location: row: 7 column: 0 @@ -47,11 +45,7 @@ expression: diagnostics row: 10 column: 16 fix: - content: - - x = x.drop( - - " columns=[\"a\"]," - - " axis=1," - - ) + content: "x = x.drop(\n columns=[\"a\"],\n axis=1,\n)" location: row: 9 column: 0 @@ -68,11 +62,7 @@ expression: diagnostics row: 17 column: 20 fix: - content: - - x = x.drop( - - " columns=[\"a\"]," - - " axis=1," - - " )" + content: "x = x.drop(\n columns=[\"a\"],\n axis=1,\n )" location: row: 16 column: 4 diff --git a/crates/ruff/src/rules/pep8_naming/mod.rs b/crates/ruff/src/rules/pep8_naming/mod.rs index 0e62ff6b59..5fef6ce59d 100644 --- a/crates/ruff/src/rules/pep8_naming/mod.rs +++ b/crates/ruff/src/rules/pep8_naming/mod.rs @@ -8,12 +8,13 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; use crate::rules::pep8_naming; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::InvalidClassName, Path::new("N801.py"); "N801")] #[test_case(Rule::InvalidFunctionName, Path::new("N802.py"); "N802")] diff --git a/crates/ruff/src/rules/pycodestyle/mod.rs b/crates/ruff/src/rules/pycodestyle/mod.rs index 4c58b68eb7..e9c60da535 100644 --- a/crates/ruff/src/rules/pycodestyle/mod.rs +++ b/crates/ruff/src/rules/pycodestyle/mod.rs @@ -10,12 +10,14 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use super::settings::Settings; use crate::registry::Rule; + use crate::settings; + use crate::source_code::LineEnding; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::AmbiguousClassName, Path::new("E742.py"))] #[test_case(Rule::AmbiguousFunctionName, Path::new("E743.py"))] @@ -35,7 +37,6 @@ mod tests { #[test_case(Rule::NoNewLineAtEndOfFile, Path::new("W292_1.py"))] #[test_case(Rule::NoNewLineAtEndOfFile, Path::new("W292_2.py"))] #[test_case(Rule::NoNewLineAtEndOfFile, Path::new("W292_3.py"))] - #[test_case(Rule::NoNewLineAtEndOfFile, Path::new("W292_4.py"))] #[test_case(Rule::NoneComparison, Path::new("E711.py"))] #[test_case(Rule::NotInTest, Path::new("E713.py"))] #[test_case(Rule::NotIsTest, Path::new("E714.py"))] @@ -53,6 +54,26 @@ mod tests { Ok(()) } + #[test] + fn w292_4() -> Result<()> { + let diagnostics = test_path( + Path::new("pycodestyle/W292_4.py"), + &settings::Settings::for_rule(Rule::NoNewLineAtEndOfFile), + )?; + + assert_yaml_snapshot!( + diagnostics, + // Replaces the platform's default line ending with `` to make the test platform- + // agnostic + { + "[].fix.content" => insta::dynamic_redaction(|value, _path| { + value.as_str().unwrap().replace(LineEnding::default().as_str(), "") + }) + } + ); + Ok(()) + } + #[cfg(feature = "logical_lines")] #[test_case(Rule::IndentationWithInvalidMultiple, Path::new("E11.py"))] #[test_case(Rule::IndentationWithInvalidMultipleComment, Path::new("E11.py"))] diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E703_E70.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E703_E70.py.snap index 696c228245..95b06e69d2 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E703_E70.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E703_E70.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 10 column: 13 fix: - content: - - "" + content: "" location: row: 10 column: 12 @@ -29,8 +28,7 @@ expression: diagnostics row: 12 column: 23 fix: - content: - - "" + content: "" location: row: 12 column: 22 @@ -47,8 +45,7 @@ expression: diagnostics row: 25 column: 14 fix: - content: - - "" + content: "" location: row: 25 column: 13 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E711_E711.py.snap index d3ace7bbf1..db553f3317 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E711_E711.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 14 fix: - content: - - res is None + content: res is None location: row: 2 column: 3 @@ -29,8 +28,7 @@ expression: diagnostics row: 5 column: 14 fix: - content: - - res is not None + content: res is not None location: row: 5 column: 3 @@ -47,8 +45,7 @@ expression: diagnostics row: 8 column: 7 fix: - content: - - None is res + content: None is res location: row: 8 column: 3 @@ -65,8 +62,7 @@ expression: diagnostics row: 11 column: 7 fix: - content: - - None is not res + content: None is not res location: row: 11 column: 3 @@ -83,8 +79,7 @@ expression: diagnostics row: 14 column: 17 fix: - content: - - "res[1] is None" + content: "res[1] is None" location: row: 14 column: 3 @@ -101,8 +96,7 @@ expression: diagnostics row: 17 column: 17 fix: - content: - - "res[1] is not None" + content: "res[1] is not None" location: row: 17 column: 3 @@ -119,8 +113,7 @@ expression: diagnostics row: 20 column: 7 fix: - content: - - "None is not res[1]" + content: "None is not res[1]" location: row: 20 column: 3 @@ -137,8 +130,7 @@ expression: diagnostics row: 23 column: 7 fix: - content: - - "None is res[1]" + content: "None is res[1]" location: row: 23 column: 3 @@ -155,8 +147,7 @@ expression: diagnostics row: 26 column: 12 fix: - content: - - x is None is not None + content: x is None is not None location: row: 26 column: 3 @@ -173,8 +164,7 @@ expression: diagnostics row: 26 column: 20 fix: - content: - - x is None is not None + content: x is None is not None location: row: 26 column: 3 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E712_E712.py.snap index 1c01fac480..bd61501743 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E712_E712.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 2 column: 14 fix: - content: - - res is True + content: res is True location: row: 2 column: 3 @@ -33,8 +32,7 @@ expression: diagnostics row: 5 column: 15 fix: - content: - - res is not False + content: res is not False location: row: 5 column: 3 @@ -53,8 +51,7 @@ expression: diagnostics row: 8 column: 7 fix: - content: - - True is not res + content: True is not res location: row: 8 column: 3 @@ -73,8 +70,7 @@ expression: diagnostics row: 11 column: 8 fix: - content: - - False is res + content: False is res location: row: 11 column: 3 @@ -93,8 +89,7 @@ expression: diagnostics row: 14 column: 17 fix: - content: - - "res[1] is True" + content: "res[1] is True" location: row: 14 column: 3 @@ -113,8 +108,7 @@ expression: diagnostics row: 17 column: 18 fix: - content: - - "res[1] is not False" + content: "res[1] is not False" location: row: 17 column: 3 @@ -133,8 +127,7 @@ expression: diagnostics row: 20 column: 23 fix: - content: - - cond is True + content: cond is True location: row: 20 column: 11 @@ -153,8 +146,7 @@ expression: diagnostics row: 20 column: 48 fix: - content: - - cond is False + content: cond is False location: row: 20 column: 35 @@ -173,8 +165,7 @@ expression: diagnostics row: 22 column: 8 fix: - content: - - True is TrueElement + content: True is TrueElement location: row: 22 column: 3 @@ -193,8 +184,7 @@ expression: diagnostics row: 25 column: 14 fix: - content: - - res is True is not False + content: res is True is not False location: row: 25 column: 3 @@ -213,8 +203,7 @@ expression: diagnostics row: 25 column: 23 fix: - content: - - res is True is not False + content: res is True is not False location: row: 25 column: 3 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E713_E713.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E713_E713.py.snap index 4685a528a3..c5fca0e4db 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E713_E713.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E713_E713.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 13 fix: - content: - - X not in Y + content: X not in Y location: row: 2 column: 3 @@ -29,8 +28,7 @@ expression: diagnostics row: 5 column: 15 fix: - content: - - X.B not in Y + content: X.B not in Y location: row: 5 column: 3 @@ -47,8 +45,7 @@ expression: diagnostics row: 8 column: 13 fix: - content: - - X not in Y + content: X not in Y location: row: 8 column: 3 @@ -65,8 +62,7 @@ expression: diagnostics row: 11 column: 28 fix: - content: - - Y not in Z + content: Y not in Z location: row: 11 column: 18 @@ -83,8 +79,7 @@ expression: diagnostics row: 14 column: 14 fix: - content: - - X not in Y + content: X not in Y location: row: 14 column: 3 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E714_E714.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E714_E714.py.snap index 138745f4e0..9bf48c1614 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E714_E714.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E714_E714.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 13 fix: - content: - - X is not Y + content: X is not Y location: row: 2 column: 3 @@ -29,8 +28,7 @@ expression: diagnostics row: 5 column: 15 fix: - content: - - X.B is not Y + content: X.B is not Y location: row: 5 column: 3 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E731_E731.py.snap index 98459243c5..06b3ac8ad9 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E731_E731.py.snap @@ -13,9 +13,7 @@ expression: diagnostics row: 2 column: 19 fix: - content: - - "def f(x):" - - " return 2 * x" + content: "def f(x):\n return 2 * x" location: row: 2 column: 0 @@ -34,9 +32,7 @@ expression: diagnostics row: 4 column: 19 fix: - content: - - "def f(x):" - - " return 2 * x" + content: "def f(x):\n return 2 * x" location: row: 4 column: 0 @@ -55,9 +51,7 @@ expression: diagnostics row: 7 column: 29 fix: - content: - - "def this(y, z):" - - " return 2 * x" + content: "def this(y, z):\n return 2 * x" location: row: 7 column: 4 @@ -76,9 +70,7 @@ expression: diagnostics row: 9 column: 21 fix: - content: - - "def f():" - - " return (yield 1)" + content: "def f():\n return (yield 1)" location: row: 9 column: 0 @@ -97,9 +89,7 @@ expression: diagnostics row: 11 column: 28 fix: - content: - - "def f():" - - " return (yield from g())" + content: "def f():\n return (yield from g())" location: row: 11 column: 0 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_0.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_0.py.snap index cd1582933f..2bc231757f 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_0.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_0.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 2 column: 8 fix: - content: - - "" - - "" + content: "\n" location: row: 2 column: 8 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_0.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_0.py.snap index 3d1e52539c..5741615437 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_0.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_0.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 11 fix: - content: - - "\\" + content: "\\" location: row: 2 column: 9 @@ -29,8 +28,7 @@ expression: diagnostics row: 6 column: 2 fix: - content: - - "\\" + content: "\\" location: row: 6 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 11 column: 7 fix: - content: - - "\\" + content: "\\" location: row: 11 column: 5 @@ -65,8 +62,7 @@ expression: diagnostics row: 18 column: 7 fix: - content: - - "\\" + content: "\\" location: row: 18 column: 5 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_1.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_1.py.snap index 3d1e52539c..5741615437 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_1.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_1.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 11 fix: - content: - - "\\" + content: "\\" location: row: 2 column: 9 @@ -29,8 +28,7 @@ expression: diagnostics row: 6 column: 2 fix: - content: - - "\\" + content: "\\" location: row: 6 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 11 column: 7 fix: - content: - - "\\" + content: "\\" location: row: 11 column: 5 @@ -65,8 +62,7 @@ expression: diagnostics row: 18 column: 7 fix: - content: - - "\\" + content: "\\" location: row: 18 column: 5 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__constant_literals.snap index c46322fe40..29ba88e251 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__constant_literals.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 4 column: 17 fix: - content: - - "==" + content: "==" location: row: 4 column: 9 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 16 fix: - content: - - "==" + content: "==" location: row: 6 column: 9 @@ -50,8 +48,7 @@ expression: diagnostics row: 8 column: 16 fix: - content: - - "==" + content: "==" location: row: 8 column: 8 @@ -69,8 +66,7 @@ expression: diagnostics row: 10 column: 17 fix: - content: - - "==" + content: "==" location: row: 10 column: 9 @@ -88,8 +84,7 @@ expression: diagnostics row: 12 column: 17 fix: - content: - - "==" + content: "==" location: row: 12 column: 9 @@ -108,8 +103,7 @@ expression: diagnostics row: 14 column: 8 fix: - content: - - False is None + content: False is None location: row: 14 column: 3 @@ -126,8 +120,7 @@ expression: diagnostics row: 14 column: 16 fix: - content: - - False is None + content: False is None location: row: 14 column: 3 @@ -144,8 +137,7 @@ expression: diagnostics row: 16 column: 7 fix: - content: - - None is False + content: None is False location: row: 16 column: 3 @@ -164,8 +156,7 @@ expression: diagnostics row: 16 column: 16 fix: - content: - - None is False + content: None is False location: row: 16 column: 3 diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_4.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__w292_4.snap similarity index 76% rename from crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_4.py.snap rename to crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__w292_4.snap index 89e72441fb..7c71a716d0 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_4.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__w292_4.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pycodestyle/mod.rs +source: crates/ruff/src/rules/pycodestyle/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 1 column: 1 fix: - content: - - "" - - "" + content: "" location: row: 1 column: 1 diff --git a/crates/ruff/src/rules/pydocstyle/mod.rs b/crates/ruff/src/rules/pydocstyle/mod.rs index a363c6f480..badefad78e 100644 --- a/crates/ruff/src/rules/pydocstyle/mod.rs +++ b/crates/ruff/src/rules/pydocstyle/mod.rs @@ -8,12 +8,13 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use super::settings::{Convention, Settings}; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::BlankLineAfterLastSection, Path::new("sections.py"); "D413")] #[test_case(Rule::BlankLineAfterSection, Path::new("sections.py"); "D410")] diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D200_D.py.snap index 4646e45656..aa53a2425b 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D200_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 131 column: 7 fix: - content: - - "\"\"\"Wrong.\"\"\"" + content: "\"\"\"Wrong.\"\"\"" location: row: 129 column: 4 @@ -29,8 +28,7 @@ expression: diagnostics row: 599 column: 13 fix: - content: - - "\"\"\"Wrong.\"\"\"" + content: "\"\"\"Wrong.\"\"\"" location: row: 597 column: 4 @@ -47,8 +45,7 @@ expression: diagnostics row: 608 column: 7 fix: - content: - - "r\"\"\"Wrong.\"\"\"" + content: "r\"\"\"Wrong.\"\"\"" location: row: 606 column: 4 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D201_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D201_D.py.snap index af79511fd0..c276fbfd9d 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D201_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D201_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 137 column: 24 fix: - content: - - "" + content: "" location: row: 136 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 151 column: 37 fix: - content: - - "" + content: "" location: row: 150 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 549 column: 7 fix: - content: - - "" + content: "" location: row: 545 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 571 column: 7 fix: - content: - - "" + content: "" location: row: 567 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D.py.snap index 8c26da993d..072e594911 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 142 column: 24 fix: - content: - - "" + content: "" location: row: 143 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 151 column: 37 fix: - content: - - "" + content: "" location: row: 152 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 558 column: 7 fix: - content: - - "" + content: "" location: row: 559 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 571 column: 7 fix: - content: - - "" + content: "" location: row: 572 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D202.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D202.py.snap index 194198d254..40f6384b5d 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D202.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D202_D202.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 57 column: 30 fix: - content: - - "" + content: "" location: row: 58 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 68 column: 30 fix: - content: - - "" + content: "" location: row: 69 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 80 column: 30 fix: - content: - - "" + content: "" location: row: 81 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D203_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D203_D.py.snap index f8a98750f9..286211e73c 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D203_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D203_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,9 +12,7 @@ expression: diagnostics row: 161 column: 32 fix: - content: - - "" - - "" + content: "\n" location: row: 161 column: 0 @@ -32,9 +30,7 @@ expression: diagnostics row: 192 column: 45 fix: - content: - - "" - - "" + content: "\n" location: row: 192 column: 0 @@ -52,9 +48,7 @@ expression: diagnostics row: 532 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 526 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D204_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D204_D.py.snap index 32b323835d..5cb60760a5 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D204_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D204_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,9 +12,7 @@ expression: diagnostics row: 181 column: 24 fix: - content: - - "" - - "" + content: "\n" location: row: 182 column: 0 @@ -32,9 +30,7 @@ expression: diagnostics row: 192 column: 45 fix: - content: - - "" - - "" + content: "\n" location: row: 193 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D205_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D205_D.py.snap index bd74c22228..0dbfd80eec 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D205_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D205_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -23,9 +23,7 @@ expression: diagnostics row: 215 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 211 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D207_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D207_D.py.snap index eabb289c36..cf6d853344 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D207_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D207_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 232 column: 0 fix: - content: - - " " + content: " " location: row: 232 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 244 column: 0 fix: - content: - - " " + content: " " location: row: 244 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 440 column: 0 fix: - content: - - " " + content: " " location: row: 440 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 441 column: 0 fix: - content: - - " " + content: " " location: row: 441 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D208_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D208_D.py.snap index 4ea97bcb3d..e1c74235fb 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D208_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D208_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 252 column: 0 fix: - content: - - " " + content: " " location: row: 252 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 264 column: 0 fix: - content: - - " " + content: " " location: row: 264 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 272 column: 0 fix: - content: - - " " + content: " " location: row: 272 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D209_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D209_D.py.snap index 04054ecff4..acadd84ba8 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D209_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D209_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 283 column: 19 fix: - content: - - "" - - " " + content: "\n " location: row: 283 column: 16 @@ -30,9 +28,7 @@ expression: diagnostics row: 590 column: 21 fix: - content: - - "" - - " " + content: "\n " location: row: 590 column: 16 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D210_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D210_D.py.snap index b2ad54fadf..01dfefcb3b 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D210_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D210_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 288 column: 33 fix: - content: - - Whitespace at the end. + content: Whitespace at the end. location: row: 288 column: 7 @@ -29,8 +28,7 @@ expression: diagnostics row: 293 column: 37 fix: - content: - - Whitespace at everywhere. + content: Whitespace at everywhere. location: row: 293 column: 7 @@ -47,8 +45,7 @@ expression: diagnostics row: 302 column: 7 fix: - content: - - Whitespace at the beginning. + content: Whitespace at the beginning. location: row: 299 column: 7 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D211_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D211_D.py.snap index f3361b8659..0ac6c67fbe 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D211_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D211_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 170 column: 29 fix: - content: - - "" + content: "" location: row: 169 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 181 column: 24 fix: - content: - - "" + content: "" location: row: 180 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D212_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D212_D.py.snap index 44af76926f..5046bebb26 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D212_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D212_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 131 column: 7 fix: - content: - - "" + content: "" location: row: 129 column: 7 @@ -29,8 +28,7 @@ expression: diagnostics row: 599 column: 13 fix: - content: - - "" + content: "" location: row: 597 column: 7 @@ -47,8 +45,7 @@ expression: diagnostics row: 626 column: 14 fix: - content: - - "" + content: "" location: row: 624 column: 7 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D213_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D213_D.py.snap index bac32409a9..8cd9fb4fd9 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D213_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D213_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,9 +11,7 @@ expression: diagnostics row: 203 column: 7 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 200 column: 7 @@ -30,9 +28,7 @@ expression: diagnostics row: 215 column: 7 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 210 column: 7 @@ -49,9 +45,7 @@ expression: diagnostics row: 224 column: 7 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 220 column: 7 @@ -68,9 +62,7 @@ expression: diagnostics row: 234 column: 7 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 230 column: 7 @@ -87,9 +79,7 @@ expression: diagnostics row: 244 column: 3 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 240 column: 7 @@ -106,9 +96,7 @@ expression: diagnostics row: 254 column: 7 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 250 column: 7 @@ -125,9 +113,7 @@ expression: diagnostics row: 264 column: 11 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 260 column: 7 @@ -144,9 +130,7 @@ expression: diagnostics row: 274 column: 7 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 270 column: 7 @@ -163,9 +147,7 @@ expression: diagnostics row: 283 column: 19 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 281 column: 7 @@ -182,9 +164,7 @@ expression: diagnostics row: 302 column: 7 fix: - content: - - "" - - " Whitespace at the beginning." + content: "\n Whitespace at the beginning." location: row: 299 column: 7 @@ -201,9 +181,7 @@ expression: diagnostics row: 348 column: 7 fix: - content: - - "" - - " Exclude some backslashes from D301." + content: "\n Exclude some backslashes from D301." location: row: 343 column: 7 @@ -220,9 +198,7 @@ expression: diagnostics row: 386 column: 7 fix: - content: - - "" - - " First line." + content: "\n First line." location: row: 383 column: 7 @@ -239,9 +215,7 @@ expression: diagnostics row: 396 column: 7 fix: - content: - - "" - - " One liner." + content: "\n One liner." location: row: 392 column: 7 @@ -258,9 +232,7 @@ expression: diagnostics row: 441 column: 7 fix: - content: - - "" - - " First Line." + content: "\n First Line." location: row: 438 column: 39 @@ -277,9 +249,7 @@ expression: diagnostics row: 454 column: 7 fix: - content: - - "" - - " Check for a bug where the previous function caused an assertion." + content: "\n Check for a bug where the previous function caused an assertion." location: row: 450 column: 7 @@ -296,9 +266,7 @@ expression: diagnostics row: 532 column: 7 fix: - content: - - "" - - " A Blah." + content: "\n A Blah." location: row: 526 column: 7 @@ -315,9 +283,7 @@ expression: diagnostics row: 549 column: 7 fix: - content: - - "" - - " Leading space." + content: "\n Leading space." location: row: 546 column: 7 @@ -334,9 +300,7 @@ expression: diagnostics row: 558 column: 7 fix: - content: - - "" - - " Leading space." + content: "\n Leading space." location: row: 555 column: 7 @@ -353,9 +317,7 @@ expression: diagnostics row: 571 column: 7 fix: - content: - - "" - - " Trailing and leading space." + content: "\n Trailing and leading space." location: row: 568 column: 7 @@ -372,9 +334,7 @@ expression: diagnostics row: 590 column: 21 fix: - content: - - "" - - " Summary." + content: "\n Summary." location: row: 588 column: 7 @@ -391,9 +351,7 @@ expression: diagnostics row: 608 column: 7 fix: - content: - - "" - - " Wrong." + content: "\n Wrong." location: row: 606 column: 8 @@ -410,9 +368,7 @@ expression: diagnostics row: 617 column: 7 fix: - content: - - "" - - " Wrong.\"" + content: "\n Wrong.\"" location: row: 615 column: 7 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D214_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D214_sections.py.snap index 3dbd93a09d..06b1d58534 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D214_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D214_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 141 column: 7 fix: - content: - - " " + content: " " location: row: 137 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D215_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D215_sections.py.snap index 12bc9ade4c..9e975a3810 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D215_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D215_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 153 column: 7 fix: - content: - - " " + content: " " location: row: 150 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 165 column: 7 fix: - content: - - " " + content: " " location: row: 164 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D.py.snap index 2ac34126c2..a4334da6ed 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 355 column: 17 fix: - content: - - "." + content: "." location: row: 355 column: 14 @@ -29,8 +28,7 @@ expression: diagnostics row: 406 column: 39 fix: - content: - - "." + content: "." location: row: 406 column: 36 @@ -47,8 +45,7 @@ expression: diagnostics row: 410 column: 24 fix: - content: - - "." + content: "." location: row: 410 column: 21 @@ -65,8 +62,7 @@ expression: diagnostics row: 416 column: 24 fix: - content: - - "." + content: "." location: row: 416 column: 21 @@ -83,8 +79,7 @@ expression: diagnostics row: 422 column: 49 fix: - content: - - "." + content: "." location: row: 422 column: 46 @@ -101,8 +96,7 @@ expression: diagnostics row: 429 column: 63 fix: - content: - - "." + content: "." location: row: 429 column: 60 @@ -119,8 +113,7 @@ expression: diagnostics row: 470 column: 24 fix: - content: - - "." + content: "." location: row: 470 column: 21 @@ -137,8 +130,7 @@ expression: diagnostics row: 475 column: 24 fix: - content: - - "." + content: "." location: row: 475 column: 21 @@ -155,8 +147,7 @@ expression: diagnostics row: 480 column: 24 fix: - content: - - "." + content: "." location: row: 480 column: 21 @@ -173,8 +164,7 @@ expression: diagnostics row: 487 column: 24 fix: - content: - - "." + content: "." location: row: 487 column: 21 @@ -191,8 +181,7 @@ expression: diagnostics row: 509 column: 34 fix: - content: - - "." + content: "." location: row: 509 column: 31 @@ -209,8 +198,7 @@ expression: diagnostics row: 514 column: 33 fix: - content: - - "." + content: "." location: row: 514 column: 30 @@ -227,8 +215,7 @@ expression: diagnostics row: 520 column: 32 fix: - content: - - "." + content: "." location: row: 520 column: 29 @@ -245,8 +232,7 @@ expression: diagnostics row: 581 column: 51 fix: - content: - - "." + content: "." location: row: 581 column: 47 @@ -263,8 +249,7 @@ expression: diagnostics row: 617 column: 7 fix: - content: - - "." + content: "." location: row: 615 column: 14 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D400.py.snap index 6882249be7..1c10546dc2 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D400_D400.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 36 fix: - content: - - "." + content: "." location: row: 2 column: 35 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 40 fix: - content: - - "." + content: "." location: row: 7 column: 37 @@ -47,8 +45,7 @@ expression: diagnostics row: 15 column: 7 fix: - content: - - "." + content: "." location: row: 14 column: 28 @@ -65,8 +62,7 @@ expression: diagnostics row: 20 column: 40 fix: - content: - - "." + content: "." location: row: 20 column: 37 @@ -83,8 +79,7 @@ expression: diagnostics row: 27 column: 31 fix: - content: - - "." + content: "." location: row: 27 column: 28 @@ -101,8 +96,7 @@ expression: diagnostics row: 34 column: 52 fix: - content: - - "." + content: "." location: row: 34 column: 48 @@ -119,8 +113,7 @@ expression: diagnostics row: 39 column: 37 fix: - content: - - "." + content: "." location: row: 39 column: 36 @@ -137,8 +130,7 @@ expression: diagnostics row: 44 column: 41 fix: - content: - - "." + content: "." location: row: 44 column: 38 @@ -155,8 +147,7 @@ expression: diagnostics row: 52 column: 7 fix: - content: - - "." + content: "." location: row: 51 column: 28 @@ -173,8 +164,7 @@ expression: diagnostics row: 57 column: 41 fix: - content: - - "." + content: "." location: row: 57 column: 38 @@ -191,8 +181,7 @@ expression: diagnostics row: 64 column: 31 fix: - content: - - "." + content: "." location: row: 64 column: 28 @@ -209,8 +198,7 @@ expression: diagnostics row: 71 column: 52 fix: - content: - - "." + content: "." location: row: 71 column: 48 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D405_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D405_sections.py.snap index a89715508a..95c482e219 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D405_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D405_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 23 column: 7 fix: - content: - - Returns + content: Returns location: row: 19 column: 4 @@ -31,8 +30,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - Short Summary + content: Short Summary location: row: 209 column: 4 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D406_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D406_sections.py.snap index 517c19401c..ddcfbacc3a 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D406_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D406_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 36 column: 7 fix: - content: - - "" + content: "" location: row: 32 column: 11 @@ -31,8 +30,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - "" + content: "" location: row: 218 column: 10 @@ -50,8 +48,7 @@ expression: diagnostics row: 262 column: 7 fix: - content: - - "" + content: "" location: row: 257 column: 11 @@ -69,8 +66,7 @@ expression: diagnostics row: 262 column: 7 fix: - content: - - "" + content: "" location: row: 259 column: 10 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D407_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D407_sections.py.snap index 17ead1f79e..c66ec344fc 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D407_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D407_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,9 +12,7 @@ expression: diagnostics row: 47 column: 7 fix: - content: - - " -------" - - "" + content: " -------\n" location: row: 45 column: 0 @@ -32,9 +30,7 @@ expression: diagnostics row: 58 column: 7 fix: - content: - - " -------" - - "" + content: " -------\n" location: row: 57 column: 0 @@ -52,9 +48,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - " ------" - - "" + content: " ------\n" location: row: 219 column: 0 @@ -72,9 +66,7 @@ expression: diagnostics row: 262 column: 7 fix: - content: - - " -------" - - "" + content: " -------\n" location: row: 258 column: 0 @@ -92,9 +84,7 @@ expression: diagnostics row: 262 column: 7 fix: - content: - - " ------" - - "" + content: " ------\n" location: row: 260 column: 0 @@ -112,9 +102,7 @@ expression: diagnostics row: 274 column: 7 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 272 column: 0 @@ -132,9 +120,7 @@ expression: diagnostics row: 292 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 289 column: 0 @@ -152,9 +138,7 @@ expression: diagnostics row: 306 column: 7 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 304 column: 0 @@ -172,9 +156,7 @@ expression: diagnostics row: 319 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 316 column: 0 @@ -192,9 +174,7 @@ expression: diagnostics row: 330 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 328 column: 0 @@ -212,9 +192,7 @@ expression: diagnostics row: 343 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 340 column: 0 @@ -232,9 +210,7 @@ expression: diagnostics row: 355 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 353 column: 0 @@ -252,9 +228,7 @@ expression: diagnostics row: 367 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 365 column: 0 @@ -272,9 +246,7 @@ expression: diagnostics row: 382 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 374 column: 0 @@ -292,9 +264,7 @@ expression: diagnostics row: 497 column: 11 fix: - content: - - " ----" - - "" + content: " ----\n" location: row: 495 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D408_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D408_sections.py.snap index 25fe5362c7..eb0b1acd44 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D408_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D408_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 92 column: 7 fix: - content: - - "" + content: "" location: row: 88 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D409_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D409_sections.py.snap index 59928ecea4..b7d7e2d17e 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D409_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D409_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,9 +12,7 @@ expression: diagnostics row: 105 column: 7 fix: - content: - - " -------" - - "" + content: " -------\n" location: row: 102 column: 0 @@ -32,9 +30,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - " -------" - - "" + content: " -------\n" location: row: 216 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D410_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D410_sections.py.snap index a7511b7f3f..7781ad14d1 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D410_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D410_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,9 +12,7 @@ expression: diagnostics row: 78 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 71 column: 0 @@ -32,9 +30,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 218 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D411_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D411_sections.py.snap index 0bb1f26b65..207fe9b6ce 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D411_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D411_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,9 +12,7 @@ expression: diagnostics row: 78 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 71 column: 0 @@ -32,9 +30,7 @@ expression: diagnostics row: 129 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 125 column: 0 @@ -52,9 +48,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - "" - - "" + content: "\n" location: row: 218 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D412_sections.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D412_sections.py.snap index 366164d8ab..9b6997b758 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D412_sections.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D412_sections.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 221 column: 7 fix: - content: - - "" + content: "" location: row: 211 column: 0 diff --git a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D415_D.py.snap index 63abf744d3..9c36793ab9 100644 --- a/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff/src/rules/pydocstyle/snapshots/ruff__rules__pydocstyle__tests__D415_D.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pydocstyle/mod.rs +source: crates/ruff/src/rules/pydocstyle/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 355 column: 17 fix: - content: - - "." + content: "." location: row: 355 column: 14 @@ -29,8 +28,7 @@ expression: diagnostics row: 406 column: 39 fix: - content: - - "." + content: "." location: row: 406 column: 36 @@ -47,8 +45,7 @@ expression: diagnostics row: 410 column: 24 fix: - content: - - "." + content: "." location: row: 410 column: 21 @@ -65,8 +62,7 @@ expression: diagnostics row: 416 column: 24 fix: - content: - - "." + content: "." location: row: 416 column: 21 @@ -83,8 +79,7 @@ expression: diagnostics row: 422 column: 49 fix: - content: - - "." + content: "." location: row: 422 column: 46 @@ -101,8 +96,7 @@ expression: diagnostics row: 429 column: 63 fix: - content: - - "." + content: "." location: row: 429 column: 60 @@ -119,8 +113,7 @@ expression: diagnostics row: 470 column: 24 fix: - content: - - "." + content: "." location: row: 470 column: 21 @@ -137,8 +130,7 @@ expression: diagnostics row: 475 column: 24 fix: - content: - - "." + content: "." location: row: 475 column: 21 @@ -155,8 +147,7 @@ expression: diagnostics row: 480 column: 24 fix: - content: - - "." + content: "." location: row: 480 column: 21 @@ -173,8 +164,7 @@ expression: diagnostics row: 487 column: 24 fix: - content: - - "." + content: "." location: row: 487 column: 21 @@ -191,8 +181,7 @@ expression: diagnostics row: 509 column: 34 fix: - content: - - "." + content: "." location: row: 509 column: 31 @@ -209,8 +198,7 @@ expression: diagnostics row: 520 column: 32 fix: - content: - - "." + content: "." location: row: 520 column: 29 @@ -227,8 +215,7 @@ expression: diagnostics row: 581 column: 51 fix: - content: - - "." + content: "." location: row: 581 column: 47 @@ -245,8 +232,7 @@ expression: diagnostics row: 617 column: 7 fix: - content: - - "." + content: "." location: row: 615 column: 14 diff --git a/crates/ruff/src/rules/pyflakes/mod.rs b/crates/ruff/src/rules/pyflakes/mod.rs index a3070097ab..e1213742d2 100644 --- a/crates/ruff/src/rules/pyflakes/mod.rs +++ b/crates/ruff/src/rules/pyflakes/mod.rs @@ -9,6 +9,7 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use regex::Regex; use rustpython_parser::lexer::LexResult; use test_case::test_case; @@ -19,7 +20,7 @@ mod tests { use crate::settings::flags; use crate::source_code::{Indexer, Locator, Stylist}; use crate::test::test_path; - use crate::{assert_yaml_snapshot, directives, rustpython_helpers, settings}; + use crate::{directives, rustpython_helpers, settings}; #[test_case(Rule::UnusedImport, Path::new("F401_0.py"); "F401_0")] #[test_case(Rule::UnusedImport, Path::new("F401_1.py"); "F401_1")] diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_0.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_0.py.snap index d42a9e481b..e9e6349954 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_0.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_0.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 2 column: 16 fix: - content: - - import os + content: import os location: row: 2 column: 0 @@ -35,11 +34,7 @@ expression: diagnostics row: 6 column: 15 fix: - content: - - from collections import ( - - " Counter," - - " namedtuple," - - ) + content: "from collections import (\n Counter,\n namedtuple,\n)" location: row: 4 column: 0 @@ -61,8 +56,7 @@ expression: diagnostics row: 12 column: 23 fix: - content: - - "" + content: "" location: row: 12 column: 0 @@ -82,8 +76,7 @@ expression: diagnostics row: 32 column: 17 fix: - content: - - "" + content: "" location: row: 32 column: 0 @@ -103,8 +96,7 @@ expression: diagnostics row: 33 column: 20 fix: - content: - - pass + content: pass location: row: 33 column: 4 @@ -124,8 +116,7 @@ expression: diagnostics row: 37 column: 18 fix: - content: - - "" + content: "" location: row: 37 column: 0 @@ -145,8 +136,7 @@ expression: diagnostics row: 52 column: 21 fix: - content: - - pass + content: pass location: row: 52 column: 8 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_5.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_5.py.snap index dc0fadb652..35f29f68ce 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_5.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_5.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 2 column: 17 fix: - content: - - "" + content: "" location: row: 2 column: 0 @@ -35,8 +34,7 @@ expression: diagnostics row: 3 column: 22 fix: - content: - - "" + content: "" location: row: 3 column: 0 @@ -56,8 +54,7 @@ expression: diagnostics row: 4 column: 10 fix: - content: - - "" + content: "" location: row: 4 column: 0 @@ -77,8 +74,7 @@ expression: diagnostics row: 5 column: 15 fix: - content: - - "" + content: "" location: row: 5 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_6.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_6.py.snap index 9710ccd47e..b910826bbb 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_6.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_6.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 7 column: 39 fix: - content: - - "" + content: "" location: row: 7 column: 0 @@ -35,8 +34,7 @@ expression: diagnostics row: 10 column: 52 fix: - content: - - "" + content: "" location: row: 10 column: 0 @@ -56,8 +54,7 @@ expression: diagnostics row: 16 column: 17 fix: - content: - - "" + content: "" location: row: 16 column: 0 @@ -77,8 +74,7 @@ expression: diagnostics row: 19 column: 35 fix: - content: - - "" + content: "" location: row: 19 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_7.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_7.py.snap index 455b8732a7..1587019e53 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_7.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_7.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -14,10 +14,7 @@ expression: diagnostics row: 30 column: 9 fix: - content: - - from typing import ( - - " Mapping, # noqa: F401" - - " )" + content: "from typing import (\n Mapping, # noqa: F401\n )" location: row: 28 column: 0 @@ -39,8 +36,7 @@ expression: diagnostics row: 66 column: 28 fix: - content: - - "" + content: "" location: row: 66 column: 0 @@ -60,8 +56,7 @@ expression: diagnostics row: 66 column: 48 fix: - content: - - "" + content: "" location: row: 66 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_9.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_9.py.snap index b2cf96d8b4..266661227e 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_9.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F401_F401_9.py.snap @@ -14,8 +14,7 @@ expression: diagnostics row: 4 column: 24 fix: - content: - - from foo import bar + content: from foo import bar location: row: 4 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F504.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F504.py.snap index 09d43725a7..9440285ce8 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F504.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F504.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 3 column: 34 fix: - content: - - "{a: \"?\", }" + content: "{a: \"?\", }" location: row: 3 column: 16 @@ -33,8 +32,7 @@ expression: diagnostics row: 8 column: 29 fix: - content: - - "{\"a\": 1, }" + content: "{\"a\": 1, }" location: row: 8 column: 10 @@ -53,8 +51,7 @@ expression: diagnostics row: 9 column: 29 fix: - content: - - "{'a': 1, }" + content: "{'a': 1, }" location: row: 9 column: 10 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F50x.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F50x.py.snap index 9cd5bf3e9e..8e60084019 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F50x.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F504_F50x.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 8 column: 32 fix: - content: - - "{'bar': 1, }" + content: "{'bar': 1, }" location: row: 8 column: 12 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F522_F522.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F522_F522.py.snap index 8c310359da..9ac9daefff 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F522_F522.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F522_F522.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 1 column: 21 fix: - content: - - "\"{}\".format(1, )" + content: "\"{}\".format(1, )" location: row: 1 column: 0 @@ -33,8 +32,7 @@ expression: diagnostics row: 2 column: 34 fix: - content: - - "\"{bar}{}\".format(1, bar=2, )" + content: "\"{bar}{}\".format(1, bar=2, )" location: row: 2 column: 0 @@ -54,8 +52,7 @@ expression: diagnostics row: 4 column: 51 fix: - content: - - "\"{bar:{spam}}\".format(bar=2, spam=3, )" + content: "\"{bar:{spam}}\".format(bar=2, spam=3, )" location: row: 4 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F541_F541.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F541_F541.py.snap index 4a27b9b71a..28108daec5 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F541_F541.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F541_F541.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 10 fix: - content: - - "\"def\"" + content: "\"def\"" location: row: 6 column: 4 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 10 fix: - content: - - "\"def\"" + content: "\"def\"" location: row: 7 column: 4 @@ -47,8 +45,7 @@ expression: diagnostics row: 9 column: 10 fix: - content: - - "\"def\"" + content: "\"def\"" location: row: 9 column: 4 @@ -65,8 +62,7 @@ expression: diagnostics row: 13 column: 8 fix: - content: - - "\"a\"" + content: "\"a\"" location: row: 13 column: 4 @@ -83,8 +79,7 @@ expression: diagnostics row: 14 column: 8 fix: - content: - - "\"b\"" + content: "\"b\"" location: row: 14 column: 4 @@ -101,8 +96,7 @@ expression: diagnostics row: 16 column: 9 fix: - content: - - "\"d\"" + content: "\"d\"" location: row: 16 column: 5 @@ -119,8 +113,7 @@ expression: diagnostics row: 17 column: 9 fix: - content: - - "r\"e\"" + content: "r\"e\"" location: row: 17 column: 4 @@ -137,8 +130,7 @@ expression: diagnostics row: 19 column: 7 fix: - content: - - "\"\"" + content: "\"\"" location: row: 19 column: 4 @@ -155,8 +147,7 @@ expression: diagnostics row: 25 column: 16 fix: - content: - - "\"z\"" + content: "\"z\"" location: row: 25 column: 12 @@ -173,8 +164,7 @@ expression: diagnostics row: 34 column: 13 fix: - content: - - "'0.2f'" + content: "'0.2f'" location: row: 34 column: 6 @@ -191,8 +181,7 @@ expression: diagnostics row: 35 column: 6 fix: - content: - - "''" + content: "''" location: row: 35 column: 3 @@ -209,8 +198,7 @@ expression: diagnostics row: 36 column: 11 fix: - content: - - "\"{test}\"" + content: "\"{test}\"" location: row: 36 column: 0 @@ -227,8 +215,7 @@ expression: diagnostics row: 37 column: 11 fix: - content: - - "'{ 40 }'" + content: "'{ 40 }'" location: row: 37 column: 0 @@ -245,8 +232,7 @@ expression: diagnostics row: 38 column: 12 fix: - content: - - "\"{a {x}\"" + content: "\"{a {x}\"" location: row: 38 column: 0 @@ -263,8 +249,7 @@ expression: diagnostics row: 39 column: 12 fix: - content: - - "\"{{x}}\"" + content: "\"{{x}}\"" location: row: 39 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F601_F601.py.snap index a54ae77911..1993de5103 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F601_F601.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -73,8 +73,7 @@ expression: diagnostics row: 18 column: 7 fix: - content: - - "" + content: "" location: row: 17 column: 10 @@ -117,8 +116,7 @@ expression: diagnostics row: 25 column: 7 fix: - content: - - "" + content: "" location: row: 24 column: 10 @@ -149,8 +147,7 @@ expression: diagnostics row: 31 column: 7 fix: - content: - - "" + content: "" location: row: 30 column: 10 @@ -229,8 +226,7 @@ expression: diagnostics row: 45 column: 7 fix: - content: - - "" + content: "" location: row: 44 column: 8 @@ -249,8 +245,7 @@ expression: diagnostics row: 49 column: 16 fix: - content: - - "" + content: "" location: row: 49 column: 11 @@ -269,8 +264,7 @@ expression: diagnostics row: 50 column: 24 fix: - content: - - "" + content: "" location: row: 50 column: 19 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F602_F602.py.snap index bd087ab27f..a5dbd00444 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F602_F602.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -49,8 +49,7 @@ expression: diagnostics row: 13 column: 5 fix: - content: - - "" + content: "" location: row: 12 column: 8 @@ -93,8 +92,7 @@ expression: diagnostics row: 20 column: 5 fix: - content: - - "" + content: "" location: row: 19 column: 8 @@ -125,8 +123,7 @@ expression: diagnostics row: 26 column: 5 fix: - content: - - "" + content: "" location: row: 25 column: 8 @@ -181,8 +178,7 @@ expression: diagnostics row: 35 column: 5 fix: - content: - - "" + content: "" location: row: 34 column: 10 @@ -237,8 +233,7 @@ expression: diagnostics row: 44 column: 12 fix: - content: - - "" + content: "" location: row: 44 column: 9 @@ -257,8 +252,7 @@ expression: diagnostics row: 45 column: 18 fix: - content: - - "" + content: "" location: row: 45 column: 15 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F632_F632.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F632_F632.py.snap index 6b24b35af0..6cb30ac06c 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F632_F632.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F632_F632.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 13 fix: - content: - - "==" + content: "==" location: row: 1 column: 5 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 15 fix: - content: - - "!=" + content: "!=" location: row: 4 column: 7 @@ -50,8 +48,7 @@ expression: diagnostics row: 8 column: 13 fix: - content: - - "!=" + content: "!=" location: row: 7 column: 7 @@ -69,8 +66,7 @@ expression: diagnostics row: 11 column: 17 fix: - content: - - "==" + content: "==" location: row: 11 column: 9 @@ -88,8 +84,7 @@ expression: diagnostics row: 14 column: 18 fix: - content: - - "==" + content: "==" location: row: 14 column: 14 @@ -107,8 +102,7 @@ expression: diagnostics row: 17 column: 20 fix: - content: - - "==" + content: "==" location: row: 17 column: 16 @@ -126,8 +120,7 @@ expression: diagnostics row: 20 column: 19 fix: - content: - - "==" + content: "==" location: row: 20 column: 15 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_0.py.snap index 85378ef2f4..173653a78d 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_0.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 22 fix: - content: - - "" + content: "" location: row: 3 column: 17 @@ -31,8 +30,7 @@ expression: diagnostics row: 16 column: 5 fix: - content: - - "" + content: "" location: row: 16 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 20 column: 7 fix: - content: - - "" + content: "" location: row: 20 column: 0 @@ -91,8 +88,7 @@ expression: diagnostics row: 26 column: 16 fix: - content: - - "" + content: "" location: row: 26 column: 13 @@ -110,8 +106,7 @@ expression: diagnostics row: 51 column: 9 fix: - content: - - pass + content: pass location: row: 51 column: 8 @@ -129,8 +124,7 @@ expression: diagnostics row: 79 column: 32 fix: - content: - - "" + content: "" location: row: 79 column: 21 @@ -148,8 +142,7 @@ expression: diagnostics row: 85 column: 31 fix: - content: - - "" + content: "" location: row: 85 column: 20 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_1.py.snap index c18c07e89d..b2a622cdc7 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_1.py.snap @@ -34,8 +34,7 @@ expression: diagnostics row: 16 column: 19 fix: - content: - - "" + content: "" location: row: 16 column: 13 @@ -53,8 +52,7 @@ expression: diagnostics row: 20 column: 10 fix: - content: - - "" + content: "" location: row: 20 column: 4 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_3.py.snap index c3ebabe0b6..c3253d8efa 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F841_F841_3.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 5 column: 5 fix: - content: - - "" + content: "" location: row: 5 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 6 column: 5 fix: - content: - - "" + content: "" location: row: 6 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 13 column: 5 fix: - content: - - "" + content: "" location: row: 13 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 14 column: 5 fix: - content: - - "" + content: "" location: row: 14 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 21 column: 20 fix: - content: - - "" + content: "" location: row: 21 column: 14 @@ -107,8 +102,7 @@ expression: diagnostics row: 27 column: 21 fix: - content: - - "" + content: "" location: row: 27 column: 15 @@ -126,8 +120,7 @@ expression: diagnostics row: 27 column: 34 fix: - content: - - "" + content: "" location: row: 27 column: 28 @@ -145,8 +138,7 @@ expression: diagnostics row: 27 column: 47 fix: - content: - - "" + content: "" location: row: 27 column: 41 @@ -186,8 +178,7 @@ expression: diagnostics row: 33 column: 22 fix: - content: - - "" + content: "" location: row: 33 column: 15 @@ -205,8 +196,7 @@ expression: diagnostics row: 34 column: 11 fix: - content: - - "" + content: "" location: row: 34 column: 4 @@ -224,8 +214,7 @@ expression: diagnostics row: 40 column: 27 fix: - content: - - "" + content: "" location: row: 40 column: 21 @@ -243,8 +232,7 @@ expression: diagnostics row: 45 column: 48 fix: - content: - - "" + content: "" location: row: 45 column: 42 @@ -262,8 +250,7 @@ expression: diagnostics row: 50 column: 5 fix: - content: - - "" + content: "" location: row: 50 column: 4 @@ -281,8 +268,7 @@ expression: diagnostics row: 56 column: 5 fix: - content: - - "" + content: "" location: row: 56 column: 4 @@ -300,8 +286,7 @@ expression: diagnostics row: 61 column: 5 fix: - content: - - pass + content: pass location: row: 61 column: 4 @@ -319,8 +304,7 @@ expression: diagnostics row: 67 column: 5 fix: - content: - - "" + content: "" location: row: 67 column: 0 @@ -338,8 +322,7 @@ expression: diagnostics row: 72 column: 25 fix: - content: - - "" + content: "" location: row: 72 column: 18 @@ -357,8 +340,7 @@ expression: diagnostics row: 77 column: 26 fix: - content: - - "" + content: "" location: row: 77 column: 19 @@ -376,8 +358,7 @@ expression: diagnostics row: 87 column: 12 fix: - content: - - "" + content: "" location: row: 87 column: 4 @@ -395,8 +376,7 @@ expression: diagnostics row: 93 column: 12 fix: - content: - - "" + content: "" location: row: 93 column: 4 @@ -414,8 +394,7 @@ expression: diagnostics row: 93 column: 17 fix: - content: - - "" + content: "" location: row: 93 column: 15 @@ -433,8 +412,7 @@ expression: diagnostics row: 97 column: 12 fix: - content: - - "" + content: "" location: row: 97 column: 4 @@ -452,8 +430,7 @@ expression: diagnostics row: 101 column: 21 fix: - content: - - "" + content: "" location: row: 101 column: 13 @@ -471,8 +448,7 @@ expression: diagnostics row: 105 column: 12 fix: - content: - - "" + content: "" location: row: 105 column: 4 @@ -490,8 +466,7 @@ expression: diagnostics row: 105 column: 17 fix: - content: - - "" + content: "" location: row: 105 column: 15 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F901_F901.py.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F901_F901.py.snap index bca2885082..18bb1acaad 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F901_F901.py.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__F901_F901.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 24 fix: - content: - - NotImplementedError + content: NotImplementedError location: row: 2 column: 10 @@ -29,8 +28,7 @@ expression: diagnostics row: 6 column: 24 fix: - content: - - NotImplementedError + content: NotImplementedError location: row: 6 column: 10 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index 5a066cd0c4..e185ade5aa 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 22 fix: - content: - - "" + content: "" location: row: 3 column: 17 @@ -31,8 +30,7 @@ expression: diagnostics row: 20 column: 7 fix: - content: - - "" + content: "" location: row: 20 column: 0 @@ -72,8 +70,7 @@ expression: diagnostics row: 26 column: 16 fix: - content: - - "" + content: "" location: row: 26 column: 13 @@ -91,8 +88,7 @@ expression: diagnostics row: 35 column: 5 fix: - content: - - "" + content: "" location: row: 35 column: 0 @@ -110,8 +106,7 @@ expression: diagnostics row: 36 column: 6 fix: - content: - - "" + content: "" location: row: 36 column: 0 @@ -129,8 +124,7 @@ expression: diagnostics row: 37 column: 14 fix: - content: - - pass + content: pass location: row: 37 column: 4 @@ -148,8 +142,7 @@ expression: diagnostics row: 51 column: 9 fix: - content: - - pass + content: pass location: row: 51 column: 8 @@ -167,8 +160,7 @@ expression: diagnostics row: 79 column: 32 fix: - content: - - "" + content: "" location: row: 79 column: 21 @@ -186,8 +178,7 @@ expression: diagnostics row: 85 column: 31 fix: - content: - - "" + content: "" location: row: 85 column: 20 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__future_annotations.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__future_annotations.snap index f7216b7428..2e62925681 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__future_annotations.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__future_annotations.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -14,10 +14,7 @@ expression: diagnostics row: 8 column: 7 fix: - content: - - from models import ( - - " Fruit," - - ) + content: "from models import (\n Fruit,\n)" location: row: 6 column: 0 diff --git a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__multi_statement_lines.snap b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__multi_statement_lines.snap index 2071052eca..fe03088dce 100644 --- a/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__multi_statement_lines.snap +++ b/crates/ruff/src/rules/pyflakes/snapshots/ruff__rules__pyflakes__tests__multi_statement_lines.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyflakes/mod.rs +source: crates/ruff/src/rules/pyflakes/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 3 column: 15 fix: - content: - - "" + content: "" location: row: 3 column: 4 @@ -35,8 +34,7 @@ expression: diagnostics row: 4 column: 15 fix: - content: - - "" + content: "" location: row: 4 column: 4 @@ -56,8 +54,7 @@ expression: diagnostics row: 7 column: 15 fix: - content: - - "" + content: "" location: row: 7 column: 4 @@ -77,8 +74,7 @@ expression: diagnostics row: 11 column: 15 fix: - content: - - "" + content: "" location: row: 11 column: 4 @@ -98,8 +94,7 @@ expression: diagnostics row: 16 column: 22 fix: - content: - - "" + content: "" location: row: 16 column: 11 @@ -119,8 +114,7 @@ expression: diagnostics row: 21 column: 20 fix: - content: - - "" + content: "" location: row: 21 column: 9 @@ -140,8 +134,7 @@ expression: diagnostics row: 26 column: 21 fix: - content: - - "" + content: "" location: row: 26 column: 10 @@ -161,8 +154,7 @@ expression: diagnostics row: 30 column: 22 fix: - content: - - "" + content: "" location: row: 30 column: 11 @@ -182,8 +174,7 @@ expression: diagnostics row: 31 column: 26 fix: - content: - - "" + content: "" location: row: 31 column: 15 @@ -203,8 +194,7 @@ expression: diagnostics row: 35 column: 20 fix: - content: - - "" + content: "" location: row: 35 column: 8 @@ -224,8 +214,7 @@ expression: diagnostics row: 40 column: 21 fix: - content: - - "" + content: "" location: row: 40 column: 9 @@ -245,8 +234,7 @@ expression: diagnostics row: 46 column: 12 fix: - content: - - "" + content: "" location: row: 46 column: 0 @@ -266,8 +254,7 @@ expression: diagnostics row: 51 column: 12 fix: - content: - - "" + content: "" location: row: 51 column: 0 diff --git a/crates/ruff/src/rules/pygrep_hooks/mod.rs b/crates/ruff/src/rules/pygrep_hooks/mod.rs index 381c3199f5..a2317d8dc3 100644 --- a/crates/ruff/src/rules/pygrep_hooks/mod.rs +++ b/crates/ruff/src/rules/pygrep_hooks/mod.rs @@ -6,11 +6,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::NoEval, Path::new("PGH001_0.py"); "PGH001_0")] #[test_case(Rule::NoEval, Path::new("PGH001_1.py"); "PGH001_1")] diff --git a/crates/ruff/src/rules/pylint/mod.rs b/crates/ruff/src/rules/pylint/mod.rs index bb97a7d37a..72e673019d 100644 --- a/crates/ruff/src/rules/pylint/mod.rs +++ b/crates/ruff/src/rules/pylint/mod.rs @@ -8,10 +8,10 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use regex::Regex; use test_case::test_case; - use crate::assert_yaml_snapshot; use crate::registry::Rule; use crate::rules::pylint; use crate::settings::Settings; diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLC0414_import_aliasing.py.snap index 949685ed27..fb839b561a 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 33 fix: - content: - - collections + content: collections location: row: 6 column: 7 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 50 fix: - content: - - OrderedDict + content: OrderedDict location: row: 7 column: 24 @@ -47,8 +45,7 @@ expression: diagnostics row: 16 column: 24 fix: - content: - - bar + content: bar location: row: 16 column: 14 @@ -65,8 +62,7 @@ expression: diagnostics row: 19 column: 28 fix: - content: - - bar + content: bar location: row: 19 column: 18 @@ -83,8 +79,7 @@ expression: diagnostics row: 20 column: 38 fix: - content: - - foobar + content: foobar location: row: 20 column: 22 @@ -101,8 +96,7 @@ expression: diagnostics row: 22 column: 24 fix: - content: - - foo + content: foo location: row: 22 column: 14 @@ -119,8 +113,7 @@ expression: diagnostics row: 23 column: 38 fix: - content: - - foo2 + content: foo2 location: row: 23 column: 26 @@ -137,8 +130,7 @@ expression: diagnostics row: 25 column: 36 fix: - content: - - foobar + content: foobar location: row: 25 column: 20 diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR0402_import_aliasing.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR0402_import_aliasing.py.snap index 56ac8e378e..0567826ac6 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR0402_import_aliasing.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR0402_import_aliasing.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -14,8 +14,7 @@ expression: diagnostics row: 9 column: 22 fix: - content: - - from os import path + content: from os import path location: row: 9 column: 0 @@ -35,8 +34,7 @@ expression: diagnostics row: 11 column: 31 fix: - content: - - from foo.bar import foobar + content: from foo.bar import foobar location: row: 11 column: 0 diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_1.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_1.py.snap index ab44f2ebd9..e570d45308 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_1.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_1.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 4 fix: - content: - - sys.exit + content: sys.exit location: row: 3 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 4 fix: - content: - - sys.exit + content: sys.exit location: row: 4 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 8 column: 8 fix: - content: - - sys.exit + content: sys.exit location: row: 8 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - sys.exit + content: sys.exit location: row: 9 column: 4 diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_2.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_2.py.snap index bc5e072854..5bd8c3d04b 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_2.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_2.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 4 fix: - content: - - sys2.exit + content: sys2.exit location: row: 3 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 4 fix: - content: - - sys2.exit + content: sys2.exit location: row: 4 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 8 column: 8 fix: - content: - - sys2.exit + content: sys2.exit location: row: 8 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - sys2.exit + content: sys2.exit location: row: 9 column: 4 diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_3.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_3.py.snap index a5b6d0f37b..e6a1d56c4c 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_3.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_3.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 4 column: 4 fix: - content: - - exit + content: exit location: row: 4 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - exit + content: exit location: row: 9 column: 4 diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_4.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_4.py.snap index a701573b90..e76192b62f 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_4.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_4.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 4 fix: - content: - - exit2 + content: exit2 location: row: 3 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 4 column: 4 fix: - content: - - exit2 + content: exit2 location: row: 4 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 8 column: 8 fix: - content: - - exit2 + content: exit2 location: row: 8 column: 4 @@ -69,8 +66,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - exit2 + content: exit2 location: row: 9 column: 4 diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_5.py.snap b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_5.py.snap index a5b6d0f37b..e6a1d56c4c 100644 --- a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_5.py.snap +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLR1722_consider_using_sys_exit_5.py.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pylint/mod.rs +source: crates/ruff/src/rules/pylint/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 4 column: 4 fix: - content: - - exit + content: exit location: row: 4 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 9 column: 8 fix: - content: - - exit + content: exit location: row: 9 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/mod.rs b/crates/ruff/src/rules/pyupgrade/mod.rs index 84446e609e..4154fe583f 100644 --- a/crates/ruff/src/rules/pyupgrade/mod.rs +++ b/crates/ruff/src/rules/pyupgrade/mod.rs @@ -10,12 +10,13 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::settings::types::PythonVersion; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::UselessMetaclassType, Path::new("UP001.py"); "UP001")] #[test_case(Rule::TypeOfPrimitive, Path::new("UP003.py"); "UP003")] diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP001.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP001.py.snap index 81a9e8e83a..1fa73a2e95 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP001.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP001.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 24 fix: - content: - - pass + content: pass location: row: 2 column: 4 @@ -29,8 +28,7 @@ expression: diagnostics row: 6 column: 24 fix: - content: - - "" + content: "" location: row: 6 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP003.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP003.py.snap index ec40c4ac7e..5a96de6e06 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP003.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP003.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 8 fix: - content: - - str + content: str location: row: 1 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 9 fix: - content: - - bytes + content: bytes location: row: 2 column: 0 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 7 fix: - content: - - int + content: int location: row: 3 column: 0 @@ -69,8 +66,7 @@ expression: diagnostics row: 4 column: 9 fix: - content: - - float + content: float location: row: 4 column: 0 @@ -88,8 +84,7 @@ expression: diagnostics row: 5 column: 8 fix: - content: - - complex + content: complex location: row: 5 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP004.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP004.py.snap index c19bd35603..a95cd5f0a7 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP004.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP004.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 5 column: 14 fix: - content: - - "" + content: "" location: row: 5 column: 7 @@ -31,8 +30,7 @@ expression: diagnostics row: 10 column: 10 fix: - content: - - "" + content: "" location: row: 9 column: 7 @@ -50,8 +48,7 @@ expression: diagnostics row: 16 column: 10 fix: - content: - - "" + content: "" location: row: 15 column: 7 @@ -69,8 +66,7 @@ expression: diagnostics row: 24 column: 10 fix: - content: - - "" + content: "" location: row: 22 column: 7 @@ -88,8 +84,7 @@ expression: diagnostics row: 31 column: 10 fix: - content: - - "" + content: "" location: row: 29 column: 7 @@ -107,8 +102,7 @@ expression: diagnostics row: 37 column: 10 fix: - content: - - "" + content: "" location: row: 36 column: 7 @@ -126,8 +120,7 @@ expression: diagnostics row: 45 column: 10 fix: - content: - - "" + content: "" location: row: 43 column: 7 @@ -145,8 +138,7 @@ expression: diagnostics row: 53 column: 10 fix: - content: - - "" + content: "" location: row: 51 column: 7 @@ -164,8 +156,7 @@ expression: diagnostics row: 61 column: 10 fix: - content: - - "" + content: "" location: row: 59 column: 7 @@ -183,8 +174,7 @@ expression: diagnostics row: 69 column: 10 fix: - content: - - "" + content: "" location: row: 67 column: 7 @@ -202,8 +192,7 @@ expression: diagnostics row: 75 column: 17 fix: - content: - - "" + content: "" location: row: 75 column: 9 @@ -221,8 +210,7 @@ expression: diagnostics row: 79 column: 14 fix: - content: - - "" + content: "" location: row: 79 column: 8 @@ -240,8 +228,7 @@ expression: diagnostics row: 84 column: 10 fix: - content: - - "" + content: "" location: row: 84 column: 4 @@ -259,8 +246,7 @@ expression: diagnostics row: 92 column: 10 fix: - content: - - "" + content: "" location: row: 91 column: 5 @@ -278,8 +264,7 @@ expression: diagnostics row: 98 column: 10 fix: - content: - - "" + content: "" location: row: 98 column: 4 @@ -297,8 +282,7 @@ expression: diagnostics row: 108 column: 10 fix: - content: - - "" + content: "" location: row: 107 column: 5 @@ -316,8 +300,7 @@ expression: diagnostics row: 114 column: 18 fix: - content: - - "" + content: "" location: row: 114 column: 11 @@ -335,8 +318,7 @@ expression: diagnostics row: 119 column: 10 fix: - content: - - "" + content: "" location: row: 118 column: 7 @@ -354,8 +336,7 @@ expression: diagnostics row: 125 column: 10 fix: - content: - - "" + content: "" location: row: 124 column: 7 @@ -373,8 +354,7 @@ expression: diagnostics row: 131 column: 10 fix: - content: - - "" + content: "" location: row: 130 column: 7 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP005.py.snap index 959b9b5af2..07544cf0f8 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP005.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 6 column: 25 fix: - content: - - self.assertEqual + content: self.assertEqual location: row: 6 column: 8 @@ -33,8 +32,7 @@ expression: diagnostics row: 7 column: 25 fix: - content: - - self.assertEqual + content: self.assertEqual location: row: 7 column: 8 @@ -53,8 +51,7 @@ expression: diagnostics row: 9 column: 34 fix: - content: - - self.assertAlmostEqual + content: self.assertAlmostEqual location: row: 9 column: 8 @@ -73,8 +70,7 @@ expression: diagnostics row: 10 column: 35 fix: - content: - - self.assertNotRegex + content: self.assertNotRegex location: row: 10 column: 8 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP006.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP006.py.snap index 0e8e08a9d1..9abf0b423f 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP006.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP006.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 4 column: 20 fix: - content: - - list + content: list location: row: 4 column: 9 @@ -31,8 +30,7 @@ expression: diagnostics row: 11 column: 13 fix: - content: - - list + content: list location: row: 11 column: 9 @@ -50,8 +48,7 @@ expression: diagnostics row: 18 column: 15 fix: - content: - - list + content: list location: row: 18 column: 9 @@ -69,8 +66,7 @@ expression: diagnostics row: 25 column: 14 fix: - content: - - list + content: list location: row: 25 column: 9 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP007.py.snap index 2940435638..c4f8211e3d 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP007.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 22 fix: - content: - - str | None + content: str | None location: row: 6 column: 9 @@ -29,8 +28,7 @@ expression: diagnostics row: 10 column: 29 fix: - content: - - str | None + content: str | None location: row: 10 column: 9 @@ -47,8 +45,7 @@ expression: diagnostics row: 14 column: 45 fix: - content: - - "str | int | Union[float, bytes]" + content: "str | int | Union[float, bytes]" location: row: 14 column: 9 @@ -65,8 +62,7 @@ expression: diagnostics row: 14 column: 44 fix: - content: - - float | bytes + content: float | bytes location: row: 14 column: 25 @@ -83,8 +79,7 @@ expression: diagnostics row: 18 column: 31 fix: - content: - - str | int + content: str | int location: row: 18 column: 9 @@ -101,8 +96,7 @@ expression: diagnostics row: 22 column: 33 fix: - content: - - str | int + content: str | int location: row: 22 column: 9 @@ -119,8 +113,7 @@ expression: diagnostics row: 26 column: 40 fix: - content: - - "(str, int) | float" + content: "(str, int) | float" location: row: 26 column: 9 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP008.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP008.py.snap index bf4f60944c..cd4742f710 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP008.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP008.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 17 column: 35 fix: - content: - - super() + content: super() location: row: 17 column: 17 @@ -29,8 +28,7 @@ expression: diagnostics row: 18 column: 26 fix: - content: - - super() + content: super() location: row: 18 column: 8 @@ -47,8 +45,7 @@ expression: diagnostics row: 22 column: 9 fix: - content: - - super() + content: super() location: row: 19 column: 8 @@ -65,8 +62,7 @@ expression: diagnostics row: 36 column: 28 fix: - content: - - super() + content: super() location: row: 36 column: 8 @@ -83,8 +79,7 @@ expression: diagnostics row: 50 column: 32 fix: - content: - - super() + content: super() location: row: 50 column: 12 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_0.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_0.py.snap index 8d4f041823..1cc2ec239c 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_0.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_0.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 0 fix: - content: - - "" + content: "" location: row: 1 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_1.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_1.py.snap index 737305d515..417a288723 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_1.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP009_1.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 3 column: 0 fix: - content: - - "" + content: "" location: row: 2 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP010.py.snap index 3fb3e38528..5fb1427cc8 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP010.py.snap @@ -14,8 +14,7 @@ expression: diagnostics row: 1 column: 48 fix: - content: - - "" + content: "" location: row: 1 column: 0 @@ -35,8 +34,7 @@ expression: diagnostics row: 2 column: 55 fix: - content: - - "" + content: "" location: row: 2 column: 0 @@ -56,8 +54,7 @@ expression: diagnostics row: 3 column: 48 fix: - content: - - "" + content: "" location: row: 3 column: 0 @@ -76,8 +73,7 @@ expression: diagnostics row: 4 column: 37 fix: - content: - - "" + content: "" location: row: 4 column: 0 @@ -97,8 +93,7 @@ expression: diagnostics row: 5 column: 53 fix: - content: - - "" + content: "" location: row: 5 column: 0 @@ -117,8 +112,7 @@ expression: diagnostics row: 6 column: 49 fix: - content: - - from __future__ import invalid_module + content: from __future__ import invalid_module location: row: 6 column: 0 @@ -137,8 +131,7 @@ expression: diagnostics row: 9 column: 41 fix: - content: - - "" + content: "" location: row: 9 column: 0 @@ -157,8 +150,7 @@ expression: diagnostics row: 10 column: 37 fix: - content: - - pass + content: pass location: row: 10 column: 4 @@ -177,8 +169,7 @@ expression: diagnostics row: 13 column: 41 fix: - content: - - "" + content: "" location: row: 13 column: 0 @@ -197,8 +188,7 @@ expression: diagnostics row: 14 column: 53 fix: - content: - - from __future__ import invalid_module + content: from __future__ import invalid_module location: row: 14 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP011.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP011.py.snap index 118c80234d..9985d60ebc 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP011.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP011.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 5 column: 22 fix: - content: - - functools.lru_cache + content: functools.lru_cache location: row: 5 column: 1 @@ -29,8 +28,7 @@ expression: diagnostics row: 10 column: 12 fix: - content: - - lru_cache + content: lru_cache location: row: 10 column: 1 @@ -47,8 +45,7 @@ expression: diagnostics row: 16 column: 22 fix: - content: - - functools.lru_cache + content: functools.lru_cache location: row: 16 column: 1 @@ -65,8 +62,7 @@ expression: diagnostics row: 21 column: 22 fix: - content: - - functools.lru_cache + content: functools.lru_cache location: row: 21 column: 1 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP012.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP012.py.snap index d073e38150..5a40942f8b 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP012.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP012.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 21 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 2 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 3 column: 18 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 3 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 4 column: 14 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 4 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 5 column: 20 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 5 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 6 column: 22 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 6 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 7 column: 30 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 7 column: 0 @@ -119,12 +113,7 @@ expression: diagnostics row: 14 column: 1 fix: - content: - - "b\"\"\"" - - Lorem - - "" - - Ipsum - - "\"\"\"" + content: "b\"\"\"\nLorem\n\nIpsum\n\"\"\"" location: row: 8 column: 0 @@ -141,8 +130,7 @@ expression: diagnostics row: 26 column: 27 fix: - content: - - "" + content: "" location: row: 26 column: 19 @@ -159,8 +147,7 @@ expression: diagnostics row: 44 column: 31 fix: - content: - - "" + content: "" location: row: 44 column: 23 @@ -177,8 +164,7 @@ expression: diagnostics row: 46 column: 39 fix: - content: - - "" + content: "" location: row: 46 column: 23 @@ -195,8 +181,7 @@ expression: diagnostics row: 48 column: 24 fix: - content: - - "br\"foo\\o\"" + content: "br\"foo\\o\"" location: row: 48 column: 0 @@ -213,8 +198,7 @@ expression: diagnostics row: 49 column: 22 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 49 column: 0 @@ -231,8 +215,7 @@ expression: diagnostics row: 50 column: 24 fix: - content: - - "bR\"foo\\o\"" + content: "bR\"foo\\o\"" location: row: 50 column: 0 @@ -249,8 +232,7 @@ expression: diagnostics row: 51 column: 22 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 51 column: 0 @@ -267,8 +249,7 @@ expression: diagnostics row: 52 column: 20 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 52 column: 6 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP013.py.snap index 2f2459d8cd..400bc3f598 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP013.py.snap @@ -12,10 +12,7 @@ expression: diagnostics row: 5 column: 52 fix: - content: - - "class MyType1(TypedDict):" - - " a: int" - - " b: str" + content: "class MyType1(TypedDict):\n a: int\n b: str" location: row: 5 column: 0 @@ -33,10 +30,7 @@ expression: diagnostics row: 8 column: 50 fix: - content: - - "class MyType2(TypedDict):" - - " a: int" - - " b: str" + content: "class MyType2(TypedDict):\n a: int\n b: str" location: row: 8 column: 0 @@ -54,10 +48,7 @@ expression: diagnostics row: 11 column: 44 fix: - content: - - "class MyType3(TypedDict):" - - " a: int" - - " b: str" + content: "class MyType3(TypedDict):\n a: int\n b: str" location: row: 11 column: 0 @@ -75,9 +66,7 @@ expression: diagnostics row: 14 column: 30 fix: - content: - - "class MyType4(TypedDict):" - - " pass" + content: "class MyType4(TypedDict):\n pass" location: row: 14 column: 0 @@ -95,9 +84,7 @@ expression: diagnostics row: 17 column: 46 fix: - content: - - "class MyType5(TypedDict):" - - " a: \"hello\"" + content: "class MyType5(TypedDict):\n a: \"hello\"" location: row: 17 column: 0 @@ -115,9 +102,7 @@ expression: diagnostics row: 18 column: 41 fix: - content: - - "class MyType6(TypedDict):" - - " a: \"hello\"" + content: "class MyType6(TypedDict):\n a: \"hello\"" location: row: 18 column: 0 @@ -135,9 +120,7 @@ expression: diagnostics row: 21 column: 56 fix: - content: - - "class MyType7(TypedDict):" - - " a: NotRequired[dict]" + content: "class MyType7(TypedDict):\n a: NotRequired[dict]" location: row: 21 column: 0 @@ -155,10 +138,7 @@ expression: diagnostics row: 24 column: 65 fix: - content: - - "class MyType8(TypedDict, total=False):" - - " x: int" - - " y: int" + content: "class MyType8(TypedDict, total=False):\n x: int\n y: int" location: row: 24 column: 0 @@ -187,9 +167,7 @@ expression: diagnostics row: 30 column: 59 fix: - content: - - "class MyType10(TypedDict):" - - " key: Literal[\"value\"]" + content: "class MyType10(TypedDict):\n key: Literal[\"value\"]" location: row: 30 column: 0 @@ -207,9 +185,7 @@ expression: diagnostics row: 33 column: 53 fix: - content: - - "class MyType11(typing.TypedDict):" - - " key: int" + content: "class MyType11(typing.TypedDict):\n key: int" location: row: 33 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP014.py.snap index 76a595f532..cd5dd8c884 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP014.py.snap @@ -12,10 +12,7 @@ expression: diagnostics row: 5 column: 61 fix: - content: - - "class NT1(NamedTuple):" - - " a: int" - - " b: tuple[str, ...]" + content: "class NT1(NamedTuple):\n a: int\n b: tuple[str, ...]" location: row: 5 column: 0 @@ -33,11 +30,7 @@ expression: diagnostics row: 12 column: 1 fix: - content: - - "class NT2(NamedTuple):" - - " a: int" - - " b: str = \"foo\"" - - " c: list[bool] = [True]" + content: "class NT2(NamedTuple):\n a: int\n b: str = \"foo\"\n c: list[bool] = [True]" location: row: 8 column: 0 @@ -55,10 +48,7 @@ expression: diagnostics row: 15 column: 56 fix: - content: - - "class NT3(typing.NamedTuple):" - - " a: int" - - " b: str" + content: "class NT3(typing.NamedTuple):\n a: int\n b: str" location: row: 15 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP015.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP015.py.snap index 2b2c886712..3d5a65fa07 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP015.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP015.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 1 column: 16 fix: - content: - - "" + content: "" location: row: 1 column: 10 @@ -31,8 +30,7 @@ expression: diagnostics row: 2 column: 17 fix: - content: - - "" + content: "" location: row: 2 column: 10 @@ -50,8 +48,7 @@ expression: diagnostics row: 3 column: 17 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 3 column: 12 @@ -69,8 +66,7 @@ expression: diagnostics row: 4 column: 18 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 4 column: 12 @@ -88,8 +84,7 @@ expression: diagnostics row: 5 column: 16 fix: - content: - - "" + content: "" location: row: 5 column: 10 @@ -107,8 +102,7 @@ expression: diagnostics row: 6 column: 17 fix: - content: - - "" + content: "" location: row: 6 column: 10 @@ -126,8 +120,7 @@ expression: diagnostics row: 7 column: 32 fix: - content: - - "" + content: "" location: row: 7 column: 8 @@ -145,8 +138,7 @@ expression: diagnostics row: 8 column: 15 fix: - content: - - "\"w\"" + content: "\"w\"" location: row: 8 column: 10 @@ -164,8 +156,7 @@ expression: diagnostics row: 10 column: 21 fix: - content: - - "" + content: "" location: row: 10 column: 15 @@ -183,8 +174,7 @@ expression: diagnostics row: 12 column: 22 fix: - content: - - "" + content: "" location: row: 12 column: 15 @@ -202,8 +192,7 @@ expression: diagnostics row: 14 column: 22 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 14 column: 17 @@ -221,8 +210,7 @@ expression: diagnostics row: 16 column: 23 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 16 column: 17 @@ -240,8 +228,7 @@ expression: diagnostics row: 18 column: 21 fix: - content: - - "" + content: "" location: row: 18 column: 15 @@ -259,8 +246,7 @@ expression: diagnostics row: 20 column: 22 fix: - content: - - "" + content: "" location: row: 20 column: 15 @@ -278,8 +264,7 @@ expression: diagnostics row: 22 column: 39 fix: - content: - - "" + content: "" location: row: 22 column: 15 @@ -297,8 +282,7 @@ expression: diagnostics row: 24 column: 22 fix: - content: - - "\"w\"" + content: "\"w\"" location: row: 24 column: 17 @@ -316,8 +300,7 @@ expression: diagnostics row: 27 column: 27 fix: - content: - - "" + content: "" location: row: 27 column: 21 @@ -335,8 +318,7 @@ expression: diagnostics row: 28 column: 28 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 28 column: 23 @@ -354,8 +336,7 @@ expression: diagnostics row: 30 column: 32 fix: - content: - - "" + content: "" location: row: 30 column: 26 @@ -373,8 +354,7 @@ expression: diagnostics row: 32 column: 33 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 32 column: 28 @@ -392,8 +372,7 @@ expression: diagnostics row: 35 column: 21 fix: - content: - - "" + content: "" location: row: 35 column: 15 @@ -411,8 +390,7 @@ expression: diagnostics row: 35 column: 45 fix: - content: - - "" + content: "" location: row: 35 column: 39 @@ -430,8 +408,7 @@ expression: diagnostics row: 37 column: 22 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 37 column: 17 @@ -449,8 +426,7 @@ expression: diagnostics row: 37 column: 47 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 37 column: 42 @@ -468,8 +444,7 @@ expression: diagnostics row: 40 column: 21 fix: - content: - - "" + content: "" location: row: 40 column: 10 @@ -487,8 +462,7 @@ expression: diagnostics row: 41 column: 26 fix: - content: - - "" + content: "" location: row: 41 column: 15 @@ -506,8 +480,7 @@ expression: diagnostics row: 42 column: 26 fix: - content: - - "" + content: "" location: row: 42 column: 5 @@ -525,8 +498,7 @@ expression: diagnostics row: 44 column: 26 fix: - content: - - "" + content: "" location: row: 44 column: 15 @@ -544,8 +516,7 @@ expression: diagnostics row: 46 column: 31 fix: - content: - - "" + content: "" location: row: 46 column: 20 @@ -563,8 +534,7 @@ expression: diagnostics row: 48 column: 31 fix: - content: - - "" + content: "" location: row: 48 column: 10 @@ -582,8 +552,7 @@ expression: diagnostics row: 51 column: 22 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 51 column: 17 @@ -601,8 +570,7 @@ expression: diagnostics row: 52 column: 27 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 52 column: 22 @@ -620,8 +588,7 @@ expression: diagnostics row: 53 column: 27 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 53 column: 10 @@ -639,8 +606,7 @@ expression: diagnostics row: 55 column: 27 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 55 column: 22 @@ -658,8 +624,7 @@ expression: diagnostics row: 57 column: 32 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 57 column: 27 @@ -677,8 +642,7 @@ expression: diagnostics row: 59 column: 32 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 59 column: 15 @@ -696,8 +660,7 @@ expression: diagnostics row: 62 column: 110 fix: - content: - - "" + content: "" location: row: 62 column: 15 @@ -715,8 +678,7 @@ expression: diagnostics row: 63 column: 110 fix: - content: - - "" + content: "" location: row: 63 column: 99 @@ -734,8 +696,7 @@ expression: diagnostics row: 64 column: 110 fix: - content: - - "" + content: "" location: row: 64 column: 58 @@ -753,8 +714,7 @@ expression: diagnostics row: 65 column: 110 fix: - content: - - "" + content: "" location: row: 65 column: 5 @@ -772,8 +732,7 @@ expression: diagnostics row: 67 column: 111 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 67 column: 22 @@ -791,8 +750,7 @@ expression: diagnostics row: 68 column: 111 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 68 column: 106 @@ -810,8 +768,7 @@ expression: diagnostics row: 69 column: 111 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 69 column: 65 @@ -829,8 +786,7 @@ expression: diagnostics row: 70 column: 111 fix: - content: - - "\"rb\"" + content: "\"rb\"" location: row: 70 column: 10 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP018.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP018.py.snap index 12e9fff404..a74f2924c1 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP018.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP018.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 20 column: 5 fix: - content: - - "\"\"" + content: "\"\"" location: row: 20 column: 0 @@ -31,8 +30,7 @@ expression: diagnostics row: 21 column: 10 fix: - content: - - "\"foo\"" + content: "\"foo\"" location: row: 21 column: 0 @@ -50,9 +48,7 @@ expression: diagnostics row: 23 column: 7 fix: - content: - - "\"\"\"" - - "foo\"\"\"" + content: "\"\"\"\nfoo\"\"\"" location: row: 22 column: 0 @@ -70,8 +66,7 @@ expression: diagnostics row: 24 column: 7 fix: - content: - - "b\"\"" + content: "b\"\"" location: row: 24 column: 0 @@ -89,8 +84,7 @@ expression: diagnostics row: 25 column: 13 fix: - content: - - "b\"foo\"" + content: "b\"foo\"" location: row: 25 column: 0 @@ -108,9 +102,7 @@ expression: diagnostics row: 27 column: 7 fix: - content: - - "b\"\"\"" - - "foo\"\"\"" + content: "b\"\"\"\nfoo\"\"\"" location: row: 26 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP019.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP019.py.snap index 6718f1eec5..9b395c2f39 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP019.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP019.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 7 column: 25 fix: - content: - - str + content: str location: row: 7 column: 21 @@ -29,8 +28,7 @@ expression: diagnostics row: 11 column: 39 fix: - content: - - str + content: str location: row: 11 column: 28 @@ -47,8 +45,7 @@ expression: diagnostics row: 15 column: 37 fix: - content: - - str + content: str location: row: 15 column: 27 @@ -65,8 +62,7 @@ expression: diagnostics row: 19 column: 35 fix: - content: - - str + content: str location: row: 19 column: 28 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP021.py.snap index cc52afedb5..cc292036fd 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP021.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 42 fix: - content: - - text + content: text location: row: 6 column: 24 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 40 fix: - content: - - text + content: text location: row: 7 column: 22 @@ -47,8 +45,7 @@ expression: diagnostics row: 9 column: 31 fix: - content: - - text + content: text location: row: 9 column: 13 @@ -65,8 +62,7 @@ expression: diagnostics row: 10 column: 39 fix: - content: - - text + content: text location: row: 10 column: 21 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP022.py.snap index f3ceae04e4..4e3d369f44 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP022.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 69 fix: - content: - - capture_output=True + content: capture_output=True location: row: 4 column: 22 @@ -29,8 +28,7 @@ expression: diagnostics row: 6 column: 80 fix: - content: - - capture_output=True + content: capture_output=True location: row: 6 column: 33 @@ -47,8 +45,7 @@ expression: diagnostics row: 8 column: 86 fix: - content: - - "capture_output=True, args=[\"foo\"]" + content: "capture_output=True, args=[\"foo\"]" location: row: 8 column: 24 @@ -65,8 +62,7 @@ expression: diagnostics row: 12 column: 1 fix: - content: - - "capture_output=True, check=True" + content: "capture_output=True, check=True" location: row: 11 column: 13 @@ -83,8 +79,7 @@ expression: diagnostics row: 16 column: 1 fix: - content: - - "capture_output=True, check=True" + content: "capture_output=True, check=True" location: row: 15 column: 13 @@ -101,9 +96,7 @@ expression: diagnostics row: 26 column: 1 fix: - content: - - "capture_output=True," - - " check=True" + content: "capture_output=True,\n check=True" location: row: 20 column: 4 @@ -120,9 +113,7 @@ expression: diagnostics row: 36 column: 5 fix: - content: - - "capture_output=True," - - " check=True" + content: "capture_output=True,\n check=True" location: row: 31 column: 8 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP023.py.snap index 2ba78b3b63..0263189224 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP023.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 59 fix: - content: - - "from xml.etree.ElementTree import XML, Element, SubElement" + content: "from xml.etree.ElementTree import XML, Element, SubElement" location: row: 2 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 3 column: 35 fix: - content: - - xml.etree.ElementTree as ET + content: xml.etree.ElementTree as ET location: row: 3 column: 7 @@ -47,8 +45,7 @@ expression: diagnostics row: 6 column: 44 fix: - content: - - from xml.etree.ElementTree import XML + content: from xml.etree.ElementTree import XML location: row: 6 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 7 column: 49 fix: - content: - - xml.etree.ElementTree as ET + content: xml.etree.ElementTree as ET location: row: 7 column: 10 @@ -83,12 +79,7 @@ expression: diagnostics row: 14 column: 1 fix: - content: - - from xml.etree.ElementTree import ( - - " XML," - - " Element," - - " SubElement," - - ) + content: "from xml.etree.ElementTree import (\n XML,\n Element,\n SubElement,\n)" location: row: 10 column: 0 @@ -105,8 +96,7 @@ expression: diagnostics row: 16 column: 39 fix: - content: - - xml.etree.ElementTree as ET + content: xml.etree.ElementTree as ET location: row: 16 column: 11 @@ -123,8 +113,7 @@ expression: diagnostics row: 17 column: 45 fix: - content: - - ElementTree as CET + content: ElementTree as CET location: row: 17 column: 26 @@ -141,8 +130,7 @@ expression: diagnostics row: 19 column: 40 fix: - content: - - ElementTree as ET + content: ElementTree as ET location: row: 19 column: 22 @@ -159,8 +147,7 @@ expression: diagnostics row: 21 column: 47 fix: - content: - - xml.etree.ElementTree as ET + content: xml.etree.ElementTree as ET location: row: 21 column: 19 @@ -177,8 +164,7 @@ expression: diagnostics row: 24 column: 59 fix: - content: - - xml.etree.ElementTree as ET + content: xml.etree.ElementTree as ET location: row: 24 column: 31 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_0.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_0.py.snap index db40934854..c6283a424e 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_0.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_0.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 6 column: 23 fix: - content: - - OSError + content: OSError location: row: 6 column: 7 @@ -31,8 +30,7 @@ expression: diagnostics row: 11 column: 14 fix: - content: - - OSError + content: OSError location: row: 11 column: 7 @@ -50,8 +48,7 @@ expression: diagnostics row: 16 column: 19 fix: - content: - - OSError + content: OSError location: row: 16 column: 7 @@ -69,8 +66,7 @@ expression: diagnostics row: 21 column: 17 fix: - content: - - OSError + content: OSError location: row: 21 column: 7 @@ -88,8 +84,7 @@ expression: diagnostics row: 26 column: 19 fix: - content: - - OSError + content: OSError location: row: 26 column: 7 @@ -107,8 +102,7 @@ expression: diagnostics row: 31 column: 19 fix: - content: - - OSError + content: OSError location: row: 31 column: 7 @@ -126,8 +120,7 @@ expression: diagnostics row: 36 column: 12 fix: - content: - - OSError + content: OSError location: row: 36 column: 7 @@ -145,8 +138,7 @@ expression: diagnostics row: 43 column: 17 fix: - content: - - OSError + content: OSError location: row: 43 column: 7 @@ -164,8 +156,7 @@ expression: diagnostics row: 47 column: 20 fix: - content: - - OSError + content: OSError location: row: 47 column: 7 @@ -183,8 +174,7 @@ expression: diagnostics row: 51 column: 57 fix: - content: - - OSError + content: OSError location: row: 51 column: 7 @@ -202,8 +192,7 @@ expression: diagnostics row: 58 column: 35 fix: - content: - - "(OSError, KeyError)" + content: "(OSError, KeyError)" location: row: 58 column: 7 @@ -221,8 +210,7 @@ expression: diagnostics row: 65 column: 23 fix: - content: - - "(OSError, error)" + content: "(OSError, error)" location: row: 65 column: 7 @@ -240,8 +228,7 @@ expression: diagnostics row: 87 column: 19 fix: - content: - - OSError + content: OSError location: row: 87 column: 7 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_1.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_1.py.snap index ddfc1f9ab7..0046a9c37d 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_1.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_1.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 5 column: 37 fix: - content: - - OSError + content: OSError location: row: 5 column: 7 @@ -31,8 +30,7 @@ expression: diagnostics row: 7 column: 40 fix: - content: - - "(OSError, KeyError)" + content: "(OSError, KeyError)" location: row: 7 column: 7 @@ -50,8 +48,7 @@ expression: diagnostics row: 16 column: 1 fix: - content: - - OSError + content: OSError location: row: 12 column: 7 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_2.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_2.py.snap index b0a61267d9..7f5945a5e5 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_2.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP024_2.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 10 column: 18 fix: - content: - - OSError + content: OSError location: row: 10 column: 6 @@ -31,8 +30,7 @@ expression: diagnostics row: 11 column: 16 fix: - content: - - OSError + content: OSError location: row: 11 column: 6 @@ -50,8 +48,7 @@ expression: diagnostics row: 12 column: 18 fix: - content: - - OSError + content: OSError location: row: 12 column: 6 @@ -69,8 +66,7 @@ expression: diagnostics row: 14 column: 18 fix: - content: - - OSError + content: OSError location: row: 14 column: 6 @@ -88,8 +84,7 @@ expression: diagnostics row: 15 column: 16 fix: - content: - - OSError + content: OSError location: row: 15 column: 6 @@ -107,8 +102,7 @@ expression: diagnostics row: 16 column: 18 fix: - content: - - OSError + content: OSError location: row: 16 column: 6 @@ -126,8 +120,7 @@ expression: diagnostics row: 18 column: 18 fix: - content: - - OSError + content: OSError location: row: 18 column: 6 @@ -145,8 +138,7 @@ expression: diagnostics row: 25 column: 11 fix: - content: - - OSError + content: OSError location: row: 25 column: 6 @@ -164,8 +156,7 @@ expression: diagnostics row: 28 column: 11 fix: - content: - - OSError + content: OSError location: row: 28 column: 6 @@ -183,8 +174,7 @@ expression: diagnostics row: 31 column: 11 fix: - content: - - OSError + content: OSError location: row: 31 column: 6 @@ -202,8 +192,7 @@ expression: diagnostics row: 34 column: 22 fix: - content: - - OSError + content: OSError location: row: 34 column: 6 @@ -221,8 +210,7 @@ expression: diagnostics row: 35 column: 13 fix: - content: - - OSError + content: OSError location: row: 35 column: 6 @@ -240,8 +228,7 @@ expression: diagnostics row: 36 column: 18 fix: - content: - - OSError + content: OSError location: row: 36 column: 6 @@ -259,8 +246,7 @@ expression: diagnostics row: 38 column: 22 fix: - content: - - OSError + content: OSError location: row: 38 column: 6 @@ -278,8 +264,7 @@ expression: diagnostics row: 39 column: 13 fix: - content: - - OSError + content: OSError location: row: 39 column: 6 @@ -297,8 +282,7 @@ expression: diagnostics row: 40 column: 18 fix: - content: - - OSError + content: OSError location: row: 40 column: 6 @@ -316,8 +300,7 @@ expression: diagnostics row: 42 column: 22 fix: - content: - - OSError + content: OSError location: row: 42 column: 6 @@ -335,8 +318,7 @@ expression: diagnostics row: 48 column: 18 fix: - content: - - OSError + content: OSError location: row: 48 column: 6 @@ -354,8 +336,7 @@ expression: diagnostics row: 49 column: 22 fix: - content: - - OSError + content: OSError location: row: 49 column: 6 @@ -373,8 +354,7 @@ expression: diagnostics row: 50 column: 13 fix: - content: - - OSError + content: OSError location: row: 50 column: 6 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP025.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP025.py.snap index 84cec2cc71..24bf39cc6a 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP025.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP025.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 12 fix: - content: - - "" + content: "" location: row: 2 column: 4 @@ -29,8 +28,7 @@ expression: diagnostics row: 4 column: 8 fix: - content: - - "" + content: "" location: row: 4 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 6 column: 14 fix: - content: - - "" + content: "" location: row: 6 column: 6 @@ -65,8 +62,7 @@ expression: diagnostics row: 8 column: 14 fix: - content: - - "" + content: "" location: row: 8 column: 6 @@ -83,8 +79,7 @@ expression: diagnostics row: 12 column: 12 fix: - content: - - "" + content: "" location: row: 12 column: 4 @@ -101,8 +96,7 @@ expression: diagnostics row: 12 column: 22 fix: - content: - - "" + content: "" location: row: 12 column: 14 @@ -119,8 +113,7 @@ expression: diagnostics row: 12 column: 34 fix: - content: - - "" + content: "" location: row: 12 column: 26 @@ -137,8 +130,7 @@ expression: diagnostics row: 12 column: 46 fix: - content: - - "" + content: "" location: row: 12 column: 38 @@ -155,8 +147,7 @@ expression: diagnostics row: 16 column: 12 fix: - content: - - "" + content: "" location: row: 16 column: 4 @@ -173,8 +164,7 @@ expression: diagnostics row: 17 column: 16 fix: - content: - - "" + content: "" location: row: 17 column: 4 @@ -191,8 +181,7 @@ expression: diagnostics row: 18 column: 16 fix: - content: - - "" + content: "" location: row: 18 column: 4 @@ -209,8 +198,7 @@ expression: diagnostics row: 19 column: 20 fix: - content: - - "" + content: "" location: row: 19 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP026.py.snap index 0f1b2a25a6..a14a09a3a4 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP026.py.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 3 column: 15 fix: - content: - - from unittest import mock + content: from unittest import mock location: row: 3 column: 4 @@ -31,9 +30,7 @@ expression: diagnostics row: 6 column: 15 fix: - content: - - import sys - - " from unittest import mock" + content: "import sys\n from unittest import mock" location: row: 6 column: 4 @@ -51,8 +48,7 @@ expression: diagnostics row: 9 column: 16 fix: - content: - - from unittest import mock + content: from unittest import mock location: row: 9 column: 0 @@ -70,9 +66,7 @@ expression: diagnostics row: 12 column: 23 fix: - content: - - "import contextlib, sys" - - from unittest import mock + content: "import contextlib, sys\nfrom unittest import mock" location: row: 12 column: 0 @@ -90,9 +84,7 @@ expression: diagnostics row: 15 column: 11 fix: - content: - - import sys - - from unittest import mock + content: "import sys\nfrom unittest import mock" location: row: 15 column: 0 @@ -110,8 +102,7 @@ expression: diagnostics row: 19 column: 21 fix: - content: - - from unittest import mock + content: from unittest import mock location: row: 19 column: 0 @@ -129,12 +120,7 @@ expression: diagnostics row: 27 column: 1 fix: - content: - - from unittest.mock import ( - - " a," - - " b," - - " c," - - ) + content: "from unittest.mock import (\n a,\n b,\n c,\n)" location: row: 22 column: 0 @@ -152,12 +138,7 @@ expression: diagnostics row: 33 column: 1 fix: - content: - - from unittest.mock import ( - - " a," - - " b," - - " c," - - ) + content: "from unittest.mock import (\n a,\n b,\n c,\n)" location: row: 28 column: 0 @@ -175,12 +156,7 @@ expression: diagnostics row: 41 column: 1 fix: - content: - - from unittest.mock import ( - - " a," - - " b," - - " c" - - ) + content: "from unittest.mock import (\n a,\n b,\n c\n)" location: row: 36 column: 0 @@ -198,12 +174,7 @@ expression: diagnostics row: 47 column: 1 fix: - content: - - from unittest.mock import ( - - " a," - - " b," - - " c" - - ) + content: "from unittest.mock import (\n a,\n b,\n c\n)" location: row: 42 column: 0 @@ -221,8 +192,7 @@ expression: diagnostics row: 48 column: 30 fix: - content: - - "from unittest.mock import a, b, c" + content: "from unittest.mock import a, b, c" location: row: 48 column: 0 @@ -240,8 +210,7 @@ expression: diagnostics row: 49 column: 30 fix: - content: - - "from unittest.mock import a, b, c" + content: "from unittest.mock import a, b, c" location: row: 49 column: 0 @@ -259,12 +228,7 @@ expression: diagnostics row: 58 column: 9 fix: - content: - - from unittest.mock import ( - - " a," - - " b," - - " c" - - " )" + content: "from unittest.mock import (\n a,\n b,\n c\n )" location: row: 53 column: 8 @@ -282,9 +246,7 @@ expression: diagnostics row: 64 column: 11 fix: - content: - - from unittest import mock - - from unittest import mock + content: "from unittest import mock\nfrom unittest import mock" location: row: 64 column: 0 @@ -302,9 +264,7 @@ expression: diagnostics row: 64 column: 17 fix: - content: - - from unittest import mock - - from unittest import mock + content: "from unittest import mock\nfrom unittest import mock" location: row: 64 column: 0 @@ -322,8 +282,7 @@ expression: diagnostics row: 67 column: 18 fix: - content: - - from unittest import mock as foo + content: from unittest import mock as foo location: row: 67 column: 0 @@ -341,8 +300,7 @@ expression: diagnostics row: 70 column: 28 fix: - content: - - from unittest import mock as foo + content: from unittest import mock as foo location: row: 70 column: 0 @@ -360,10 +318,7 @@ expression: diagnostics row: 74 column: 22 fix: - content: - - from unittest import mock as foo - - " from unittest import mock as bar" - - " from unittest import mock" + content: "from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 74 column: 4 @@ -381,10 +336,7 @@ expression: diagnostics row: 74 column: 35 fix: - content: - - from unittest import mock as foo - - " from unittest import mock as bar" - - " from unittest import mock" + content: "from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 74 column: 4 @@ -402,10 +354,7 @@ expression: diagnostics row: 74 column: 41 fix: - content: - - from unittest import mock as foo - - " from unittest import mock as bar" - - " from unittest import mock" + content: "from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 74 column: 4 @@ -423,11 +372,7 @@ expression: diagnostics row: 77 column: 22 fix: - content: - - import os - - " from unittest import mock as foo" - - " from unittest import mock as bar" - - " from unittest import mock" + content: "import os\n from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 77 column: 4 @@ -445,11 +390,7 @@ expression: diagnostics row: 77 column: 35 fix: - content: - - import os - - " from unittest import mock as foo" - - " from unittest import mock as bar" - - " from unittest import mock" + content: "import os\n from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 77 column: 4 @@ -467,11 +408,7 @@ expression: diagnostics row: 77 column: 41 fix: - content: - - import os - - " from unittest import mock as foo" - - " from unittest import mock as bar" - - " from unittest import mock" + content: "import os\n from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 77 column: 4 @@ -489,10 +426,7 @@ expression: diagnostics row: 81 column: 51 fix: - content: - - from unittest import mock as foo - - " from unittest import mock as bar" - - " from unittest import mock" + content: "from unittest import mock as foo\n from unittest import mock as bar\n from unittest import mock" location: row: 81 column: 4 @@ -510,8 +444,7 @@ expression: diagnostics row: 88 column: 13 fix: - content: - - mock + content: mock location: row: 88 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP027.py.snap index 9ac647eb41..cdbfe7e6a7 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP027.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 38 fix: - content: - - (fn(x) for x in items) + content: (fn(x) for x in items) location: row: 2 column: 16 @@ -29,8 +28,7 @@ expression: diagnostics row: 4 column: 37 fix: - content: - - (fn(x) for x in items) + content: (fn(x) for x in items) location: row: 4 column: 15 @@ -47,8 +45,7 @@ expression: diagnostics row: 6 column: 47 fix: - content: - - (fn(x) for x in items) + content: (fn(x) for x in items) location: row: 6 column: 25 @@ -65,8 +62,7 @@ expression: diagnostics row: 8 column: 51 fix: - content: - - "([i for i in fn(x)] for x in items)" + content: "([i for i in fn(x)] for x in items)" location: row: 8 column: 16 @@ -83,11 +79,7 @@ expression: diagnostics row: 13 column: 1 fix: - content: - - ( - - " fn(x)" - - " for x in items" - - ) + content: "(\n fn(x)\n for x in items\n)" location: row: 10 column: 16 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP028_0.py.snap index eb94c57c0c..a877c9b71a 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP028_0.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 3 column: 15 fix: - content: - - yield from y + content: yield from y location: row: 2 column: 4 @@ -29,8 +28,7 @@ expression: diagnostics row: 8 column: 20 fix: - content: - - yield from z + content: yield from z location: row: 7 column: 4 @@ -47,8 +45,7 @@ expression: diagnostics row: 13 column: 15 fix: - content: - - "yield from [1, 2, 3]" + content: "yield from [1, 2, 3]" location: row: 12 column: 4 @@ -65,8 +62,7 @@ expression: diagnostics row: 18 column: 15 fix: - content: - - "yield from {x for x in y}" + content: "yield from {x for x in y}" location: row: 17 column: 4 @@ -83,8 +79,7 @@ expression: diagnostics row: 23 column: 15 fix: - content: - - "yield from (1, 2, 3)" + content: "yield from (1, 2, 3)" location: row: 22 column: 4 @@ -101,8 +96,7 @@ expression: diagnostics row: 28 column: 18 fix: - content: - - "yield from {3: \"x\", 6: \"y\"}" + content: "yield from {3: \"x\", 6: \"y\"}" location: row: 27 column: 4 @@ -119,12 +113,7 @@ expression: diagnostics row: 39 column: 18 fix: - content: - - "yield from { # Comment three\\n'" - - " 3: \"x\", # Comment four\\n'" - - " # Comment five\\n'" - - " 6: \"y\", # Comment six\\n'" - - " }" + content: "yield from { # Comment three\\n'\n 3: \"x\", # Comment four\\n'\n # Comment five\\n'\n 6: \"y\", # Comment six\\n'\n }" location: row: 33 column: 4 @@ -141,8 +130,7 @@ expression: diagnostics row: 45 column: 18 fix: - content: - - "yield from [{3: (3, [44, \"long ss\"]), 6: \"y\"}]" + content: "yield from [{3: (3, [44, \"long ss\"]), 6: \"y\"}]" location: row: 44 column: 4 @@ -159,8 +147,7 @@ expression: diagnostics row: 50 column: 18 fix: - content: - - yield from z() + content: yield from z() location: row: 49 column: 4 @@ -177,8 +164,7 @@ expression: diagnostics row: 57 column: 22 fix: - content: - - yield from z() + content: yield from z() location: row: 55 column: 8 @@ -195,8 +181,7 @@ expression: diagnostics row: 68 column: 15 fix: - content: - - yield from x + content: yield from x location: row: 67 column: 4 @@ -213,8 +198,7 @@ expression: diagnostics row: 73 column: 18 fix: - content: - - yield from z() + content: yield from z() location: row: 72 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP029.py.snap index 3a76d6b8e2..87243f2e75 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP029.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 1 column: 22 fix: - content: - - "" + content: "" location: row: 1 column: 0 @@ -34,8 +33,7 @@ expression: diagnostics row: 2 column: 42 fix: - content: - - from builtins import compile + content: from builtins import compile location: row: 2 column: 0 @@ -55,8 +53,7 @@ expression: diagnostics row: 4 column: 46 fix: - content: - - from six.moves import zip_longest + content: from six.moves import zip_longest location: row: 4 column: 0 @@ -75,8 +72,7 @@ expression: diagnostics row: 5 column: 19 fix: - content: - - "" + content: "" location: row: 5 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_0.py.snap index 509b557f8c..f0a0b813fc 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_0.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 3 column: 33 fix: - content: - - "\"{}\" \"{}\" \"{}\".format(1, 2, 3)" + content: "\"{}\" \"{}\" \"{}\".format(1, 2, 3)" location: row: 3 column: 0 @@ -29,10 +28,7 @@ expression: diagnostics row: 7 column: 1 fix: - content: - - "\"a {} complicated {} string with {} {}\".format(" - - " \"fourth\", \"second\", \"first\", \"third\"" - - ) + content: "\"a {} complicated {} string with {} {}\".format(\n \"fourth\", \"second\", \"first\", \"third\"\n)" location: row: 5 column: 0 @@ -49,8 +45,7 @@ expression: diagnostics row: 9 column: 15 fix: - content: - - "'{}'.format(1)" + content: "'{}'.format(1)" location: row: 9 column: 0 @@ -67,8 +62,7 @@ expression: diagnostics row: 11 column: 18 fix: - content: - - "'{:x}'.format(30)" + content: "'{:x}'.format(30)" location: row: 11 column: 0 @@ -85,8 +79,7 @@ expression: diagnostics row: 13 column: 19 fix: - content: - - "'{}'.format(1)" + content: "'{}'.format(1)" location: row: 13 column: 4 @@ -103,8 +96,7 @@ expression: diagnostics row: 15 column: 29 fix: - content: - - "'''{}\\n{}\\n'''.format(1, 2)" + content: "'''{}\\n{}\\n'''.format(1, 2)" location: row: 15 column: 0 @@ -121,9 +113,7 @@ expression: diagnostics row: 18 column: 26 fix: - content: - - "\"foo {}\" \\" - - " \"bar {}\".format(1, 2)" + content: "\"foo {}\" \\\n \"bar {}\".format(1, 2)" location: row: 17 column: 4 @@ -140,8 +130,7 @@ expression: diagnostics row: 20 column: 17 fix: - content: - - "(\"{}\").format(1)" + content: "(\"{}\").format(1)" location: row: 20 column: 0 @@ -158,8 +147,7 @@ expression: diagnostics row: 22 column: 27 fix: - content: - - "\"\\N{snowman} {}\".format(1)" + content: "\"\\N{snowman} {}\".format(1)" location: row: 22 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_2.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_2.py.snap index 7c5d8739d3..87dcaf6ec2 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_2.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP030_2.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 19 fix: - content: - - "\"{}\".format(*args)" + content: "\"{}\".format(*args)" location: row: 6 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 8 column: 22 fix: - content: - - "\"{}\".format(**kwargs)" + content: "\"{}\".format(**kwargs)" location: row: 8 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 10 column: 23 fix: - content: - - "\"{}_{}\".format(*args)" + content: "\"{}_{}\".format(*args)" location: row: 10 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 12 column: 26 fix: - content: - - "\"{}_{}\".format(1, *args)" + content: "\"{}_{}\".format(1, *args)" location: row: 12 column: 0 @@ -93,8 +89,7 @@ expression: diagnostics row: 16 column: 26 fix: - content: - - "\"{}_{}\".format(*args, 1)" + content: "\"{}_{}\".format(*args, 1)" location: row: 16 column: 0 @@ -111,8 +106,7 @@ expression: diagnostics row: 18 column: 29 fix: - content: - - "\"{}_{}\".format(1, 2, *args)" + content: "\"{}_{}\".format(1, 2, *args)" location: row: 18 column: 0 @@ -129,8 +123,7 @@ expression: diagnostics row: 20 column: 29 fix: - content: - - "\"{}_{}\".format(*args, 1, 2)" + content: "\"{}_{}\".format(*args, 1, 2)" location: row: 20 column: 0 @@ -147,8 +140,7 @@ expression: diagnostics row: 22 column: 33 fix: - content: - - "\"{}_{}_{}\".format(1, **kwargs)" + content: "\"{}_{}_{}\".format(1, **kwargs)" location: row: 22 column: 0 @@ -165,8 +157,7 @@ expression: diagnostics row: 24 column: 36 fix: - content: - - "\"{}_{}_{}\".format(1, 2, **kwargs)" + content: "\"{}_{}_{}\".format(1, 2, **kwargs)" location: row: 24 column: 0 @@ -183,8 +174,7 @@ expression: diagnostics row: 26 column: 39 fix: - content: - - "\"{}_{}_{}\".format(1, 2, 3, **kwargs)" + content: "\"{}_{}_{}\".format(1, 2, 3, **kwargs)" location: row: 26 column: 0 @@ -201,8 +191,7 @@ expression: diagnostics row: 28 column: 46 fix: - content: - - "\"{}_{}_{}\".format(1, 2, 3, *args, **kwargs)" + content: "\"{}_{}_{}\".format(1, 2, 3, *args, **kwargs)" location: row: 28 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP031_0.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP031_0.py.snap index 29db431503..db63c11a3f 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP031_0.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP031_0.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 4 column: 22 fix: - content: - - "'{} {}'.format(a, b)" + content: "'{} {}'.format(a, b)" location: row: 4 column: 6 @@ -29,8 +28,7 @@ expression: diagnostics row: 6 column: 21 fix: - content: - - "'{}{}'.format(a, b)" + content: "'{}{}'.format(a, b)" location: row: 6 column: 6 @@ -47,8 +45,7 @@ expression: diagnostics row: 8 column: 20 fix: - content: - - "\"trivial\".format()" + content: "\"trivial\".format()" location: row: 8 column: 6 @@ -65,8 +62,7 @@ expression: diagnostics row: 10 column: 24 fix: - content: - - "\"{}\".format(\"simple\")" + content: "\"{}\".format(\"simple\")" location: row: 10 column: 6 @@ -83,8 +79,7 @@ expression: diagnostics row: 12 column: 34 fix: - content: - - "\"{}\".format(\"%s\" % (\"nested\",))" + content: "\"{}\".format(\"%s\" % (\"nested\",))" location: row: 12 column: 6 @@ -101,8 +96,7 @@ expression: diagnostics row: 12 column: 32 fix: - content: - - "\"{}\".format(\"nested\")" + content: "\"{}\".format(\"nested\")" location: row: 12 column: 14 @@ -119,8 +113,7 @@ expression: diagnostics row: 14 column: 28 fix: - content: - - "\"{}% percent\".format(15)" + content: "\"{}% percent\".format(15)" location: row: 14 column: 6 @@ -137,8 +130,7 @@ expression: diagnostics row: 16 column: 18 fix: - content: - - "\"{:f}\".format(15)" + content: "\"{:f}\".format(15)" location: row: 16 column: 6 @@ -155,8 +147,7 @@ expression: diagnostics row: 18 column: 19 fix: - content: - - "\"{:.0f}\".format(15)" + content: "\"{:.0f}\".format(15)" location: row: 18 column: 6 @@ -173,8 +164,7 @@ expression: diagnostics row: 20 column: 20 fix: - content: - - "\"{:.3f}\".format(15)" + content: "\"{:.3f}\".format(15)" location: row: 20 column: 6 @@ -191,8 +181,7 @@ expression: diagnostics row: 22 column: 19 fix: - content: - - "\"{:3f}\".format(15)" + content: "\"{:3f}\".format(15)" location: row: 22 column: 6 @@ -209,8 +198,7 @@ expression: diagnostics row: 24 column: 19 fix: - content: - - "\"{:<5f}\".format(5)" + content: "\"{:<5f}\".format(5)" location: row: 24 column: 6 @@ -227,8 +215,7 @@ expression: diagnostics row: 26 column: 18 fix: - content: - - "\"{:9f}\".format(5)" + content: "\"{:9f}\".format(5)" location: row: 26 column: 6 @@ -245,8 +232,7 @@ expression: diagnostics row: 28 column: 20 fix: - content: - - "\"{:#o}\".format(123)" + content: "\"{:#o}\".format(123)" location: row: 28 column: 6 @@ -263,8 +249,7 @@ expression: diagnostics row: 30 column: 26 fix: - content: - - "\"brace {{}} {}\".format(1)" + content: "\"brace {{}} {}\".format(1)" location: row: 30 column: 6 @@ -281,10 +266,7 @@ expression: diagnostics row: 35 column: 9 fix: - content: - - "\"{}\".format(" - - " \"trailing comma\"," - - " )" + content: "\"{}\".format(\n \"trailing comma\",\n )" location: row: 33 column: 2 @@ -301,8 +283,7 @@ expression: diagnostics row: 38 column: 22 fix: - content: - - "\"foo {} \".format(x)" + content: "\"foo {} \".format(x)" location: row: 38 column: 6 @@ -319,8 +300,7 @@ expression: diagnostics row: 40 column: 26 fix: - content: - - "\"{k}\".format(k=\"v\")" + content: "\"{k}\".format(k=\"v\")" location: row: 40 column: 6 @@ -337,11 +317,7 @@ expression: diagnostics row: 45 column: 1 fix: - content: - - "\"{k}\".format(" - - " k=\"v\"," - - " i=\"j\"," - - ) + content: "\"{k}\".format(\n k=\"v\",\n i=\"j\",\n)" location: row: 42 column: 6 @@ -358,8 +334,7 @@ expression: diagnostics row: 47 column: 37 fix: - content: - - "\"{to_list}\".format(to_list=[])" + content: "\"{to_list}\".format(to_list=[])" location: row: 47 column: 6 @@ -376,8 +351,7 @@ expression: diagnostics row: 49 column: 43 fix: - content: - - "\"{k}\".format(k=\"v\", i=1, j=[])" + content: "\"{k}\".format(k=\"v\", i=1, j=[])" location: row: 49 column: 6 @@ -394,8 +368,7 @@ expression: diagnostics row: 51 column: 29 fix: - content: - - "\"{ab}\".format(ab=1)" + content: "\"{ab}\".format(ab=1)" location: row: 51 column: 6 @@ -412,8 +385,7 @@ expression: diagnostics row: 53 column: 27 fix: - content: - - "\"{a}\".format(a=1)" + content: "\"{a}\".format(a=1)" location: row: 53 column: 6 @@ -430,9 +402,7 @@ expression: diagnostics row: 57 column: 21 fix: - content: - - "\"foo {} \"" - - " \"bar {}\".format(x, y)" + content: "\"foo {} \"\n \"bar {}\".format(x, y)" location: row: 56 column: 4 @@ -449,9 +419,7 @@ expression: diagnostics row: 62 column: 40 fix: - content: - - "\"foo {foo} \"" - - " \"bar {bar}\".format(foo=x, bar=y)" + content: "\"foo {foo} \"\n \"bar {bar}\".format(foo=x, bar=y)" location: row: 61 column: 4 @@ -468,9 +436,7 @@ expression: diagnostics row: 68 column: 37 fix: - content: - - "\"foo {foo} \"" - - " \"bar {bar}\".format(foo=x, **bar)" + content: "\"foo {foo} \"\n \"bar {bar}\".format(foo=x, **bar)" location: row: 67 column: 4 @@ -487,8 +453,7 @@ expression: diagnostics row: 71 column: 29 fix: - content: - - "\"{} \\N{snowman}\".format(a)" + content: "\"{} \\N{snowman}\".format(a)" location: row: 71 column: 6 @@ -505,8 +470,7 @@ expression: diagnostics row: 73 column: 40 fix: - content: - - "\"{foo} \\N{snowman}\".format(foo=1)" + content: "\"{foo} \\N{snowman}\".format(foo=1)" location: row: 73 column: 6 @@ -523,8 +487,7 @@ expression: diagnostics row: 75 column: 35 fix: - content: - - "(\"foo {} \" \"bar {}\").format(x, y)" + content: "(\"foo {} \" \"bar {}\").format(x, y)" location: row: 75 column: 6 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP032.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP032.py.snap index 3f4ae77c46..95e09d6b5a 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP032.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP032.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 5 column: 20 fix: - content: - - "f\"{a} {b}\"" + content: "f\"{a} {b}\"" location: row: 5 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 7 column: 22 fix: - content: - - "f\"{b} {a}\"" + content: "f\"{b} {a}\"" location: row: 7 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 9 column: 19 fix: - content: - - "f\"{z.y}\"" + content: "f\"{z.y}\"" location: row: 9 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 11 column: 24 fix: - content: - - "f\"{a.x} {b.y}\"" + content: "f\"{a.x} {b.y}\"" location: row: 11 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 13 column: 24 fix: - content: - - "f\"{a.b} {c.d}\"" + content: "f\"{a.b} {c.d}\"" location: row: 13 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 15 column: 16 fix: - content: - - "f\"{a()}\"" + content: "f\"{a()}\"" location: row: 15 column: 0 @@ -119,8 +113,7 @@ expression: diagnostics row: 17 column: 18 fix: - content: - - "f\"{a.b()}\"" + content: "f\"{a.b()}\"" location: row: 17 column: 0 @@ -137,8 +130,7 @@ expression: diagnostics row: 19 column: 22 fix: - content: - - "f\"{a.b().c()}\"" + content: "f\"{a.b().c()}\"" location: row: 19 column: 0 @@ -155,8 +147,7 @@ expression: diagnostics row: 21 column: 24 fix: - content: - - "f\"hello {name}!\"" + content: "f\"hello {name}!\"" location: row: 21 column: 0 @@ -173,8 +164,7 @@ expression: diagnostics row: 23 column: 27 fix: - content: - - "f\"{a}{b}{c}\"" + content: "f\"{a}{b}{c}\"" location: row: 23 column: 0 @@ -191,8 +181,7 @@ expression: diagnostics row: 25 column: 16 fix: - content: - - "f\"{0x0}\"" + content: "f\"{0x0}\"" location: row: 25 column: 0 @@ -209,8 +198,7 @@ expression: diagnostics row: 27 column: 20 fix: - content: - - "f\"{a} {b}\"" + content: "f\"{a} {b}\"" location: row: 27 column: 0 @@ -227,8 +215,7 @@ expression: diagnostics row: 29 column: 24 fix: - content: - - "f\"\"\"{a} {b}\"\"\"" + content: "f\"\"\"{a} {b}\"\"\"" location: row: 29 column: 0 @@ -245,8 +232,7 @@ expression: diagnostics row: 31 column: 17 fix: - content: - - "f\"foo{1}\"" + content: "f\"foo{1}\"" location: row: 31 column: 0 @@ -263,8 +249,7 @@ expression: diagnostics row: 33 column: 18 fix: - content: - - "fr\"foo{1}\"" + content: "fr\"foo{1}\"" location: row: 33 column: 0 @@ -281,8 +266,7 @@ expression: diagnostics row: 35 column: 21 fix: - content: - - "f\"{1}\"" + content: "f\"{1}\"" location: row: 35 column: 4 @@ -299,8 +283,7 @@ expression: diagnostics row: 37 column: 25 fix: - content: - - "f\"foo {x} \"" + content: "f\"foo {x} \"" location: row: 37 column: 6 @@ -317,8 +300,7 @@ expression: diagnostics row: 39 column: 20 fix: - content: - - "f\"{a[b]}\"" + content: "f\"{a[b]}\"" location: row: 39 column: 0 @@ -335,8 +317,7 @@ expression: diagnostics row: 41 column: 22 fix: - content: - - "f\"{a.a[b]}\"" + content: "f\"{a.a[b]}\"" location: row: 41 column: 0 @@ -353,8 +334,7 @@ expression: diagnostics row: 43 column: 29 fix: - content: - - "f\"{escaped}{{}}{y}\"" + content: "f\"{escaped}{{}}{y}\"" location: row: 43 column: 0 @@ -371,8 +351,7 @@ expression: diagnostics row: 45 column: 14 fix: - content: - - "f\"{a}\"" + content: "f\"{a}\"" location: row: 45 column: 0 @@ -389,8 +368,7 @@ expression: diagnostics row: 47 column: 24 fix: - content: - - "f'({a}={{0!e}})'" + content: "f'({a}={{0!e}})'" location: row: 47 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP033.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP033.py.snap index 4fe948dcb4..7a1b50d870 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP033.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP033.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 5 column: 34 fix: - content: - - functools.cache + content: functools.cache location: row: 5 column: 1 @@ -39,8 +38,7 @@ expression: diagnostics row: 16 column: 34 fix: - content: - - functools.cache + content: functools.cache location: row: 16 column: 1 @@ -57,8 +55,7 @@ expression: diagnostics row: 21 column: 34 fix: - content: - - functools.cache + content: functools.cache location: row: 21 column: 1 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP034.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP034.py.snap index 1cad3ddaea..55d295cb4e 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP034.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP034.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 2 column: 13 fix: - content: - - "\"foo\"" + content: "\"foo\"" location: row: 2 column: 6 @@ -29,8 +28,7 @@ expression: diagnostics row: 5 column: 26 fix: - content: - - "\"hell((goodybe))o\"" + content: "\"hell((goodybe))o\"" location: row: 5 column: 6 @@ -47,8 +45,7 @@ expression: diagnostics row: 8 column: 15 fix: - content: - - "(\"foo\")" + content: "(\"foo\")" location: row: 8 column: 6 @@ -65,8 +62,7 @@ expression: diagnostics row: 11 column: 13 fix: - content: - - ((1)) + content: ((1)) location: row: 11 column: 6 @@ -83,8 +79,7 @@ expression: diagnostics row: 14 column: 25 fix: - content: - - "\"foo{}\".format(1)" + content: "\"foo{}\".format(1)" location: row: 14 column: 6 @@ -101,8 +96,7 @@ expression: diagnostics row: 18 column: 23 fix: - content: - - "\"foo{}\".format(1)" + content: "\"foo{}\".format(1)" location: row: 18 column: 4 @@ -119,10 +113,7 @@ expression: diagnostics row: 25 column: 5 fix: - content: - - "" - - " \"foo\"" - - " " + content: "\n \"foo\"\n " location: row: 23 column: 4 @@ -139,8 +130,7 @@ expression: diagnostics row: 30 column: 23 fix: - content: - - (yield 1) + content: (yield 1) location: row: 30 column: 12 @@ -157,8 +147,7 @@ expression: diagnostics row: 35 column: 27 fix: - content: - - "\"foo{}\".format(1)" + content: "\"foo{}\".format(1)" location: row: 35 column: 8 @@ -175,8 +164,7 @@ expression: diagnostics row: 39 column: 27 fix: - content: - - x for x in range(3) + content: x for x in range(3) location: row: 39 column: 6 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP035.py.snap index d118b247b9..aefe1af043 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP035.py.snap @@ -15,8 +15,7 @@ expression: diagnostics row: 2 column: 31 fix: - content: - - from collections.abc import Mapping + content: from collections.abc import Mapping location: row: 2 column: 0 @@ -37,8 +36,7 @@ expression: diagnostics row: 4 column: 38 fix: - content: - - from collections.abc import Mapping as MAP + content: from collections.abc import Mapping as MAP location: row: 4 column: 0 @@ -60,8 +58,7 @@ expression: diagnostics row: 6 column: 41 fix: - content: - - "from collections.abc import Mapping, Sequence" + content: "from collections.abc import Mapping, Sequence" location: row: 6 column: 0 @@ -82,9 +79,7 @@ expression: diagnostics row: 8 column: 40 fix: - content: - - from collections import Counter - - from collections.abc import Mapping + content: "from collections import Counter\nfrom collections.abc import Mapping" location: row: 8 column: 0 @@ -105,9 +100,7 @@ expression: diagnostics row: 10 column: 42 fix: - content: - - from collections import (Counter) - - from collections.abc import Mapping + content: "from collections import (Counter)\nfrom collections.abc import Mapping" location: row: 10 column: 0 @@ -128,9 +121,7 @@ expression: diagnostics row: 13 column: 33 fix: - content: - - from collections import (Counter) - - from collections.abc import Mapping + content: "from collections import (Counter)\nfrom collections.abc import Mapping" location: row: 12 column: 0 @@ -151,9 +142,7 @@ expression: diagnostics row: 16 column: 32 fix: - content: - - from collections import Counter - - from collections.abc import Mapping + content: "from collections import Counter\nfrom collections.abc import Mapping" location: row: 15 column: 0 @@ -175,9 +164,7 @@ expression: diagnostics row: 18 column: 50 fix: - content: - - from collections import Counter - - "from collections.abc import Mapping, Sequence" + content: "from collections import Counter\nfrom collections.abc import Mapping, Sequence" location: row: 18 column: 0 @@ -198,9 +185,7 @@ expression: diagnostics row: 20 column: 51 fix: - content: - - from collections import Counter - - from collections.abc import Mapping as mapping + content: "from collections import Counter\nfrom collections.abc import Mapping as mapping" location: row: 20 column: 0 @@ -221,9 +206,7 @@ expression: diagnostics row: 23 column: 44 fix: - content: - - from collections import Counter - - " from collections.abc import Mapping" + content: "from collections import Counter\n from collections.abc import Mapping" location: row: 23 column: 4 @@ -244,9 +227,7 @@ expression: diagnostics row: 28 column: 44 fix: - content: - - from collections import Counter - - " from collections.abc import Mapping" + content: "from collections import Counter\n from collections.abc import Mapping" location: row: 28 column: 4 @@ -267,8 +248,7 @@ expression: diagnostics row: 30 column: 40 fix: - content: - - from collections.abc import Mapping + content: from collections.abc import Mapping location: row: 30 column: 9 @@ -289,9 +269,7 @@ expression: diagnostics row: 33 column: 40 fix: - content: - - from collections import Counter - - from collections.abc import Mapping + content: "from collections import Counter\nfrom collections.abc import Mapping" location: row: 33 column: 0 @@ -313,12 +291,7 @@ expression: diagnostics row: 42 column: 5 fix: - content: - - from collections import ( - - " Bad," - - " Good," - - " )" - - " from collections.abc import Mapping, Callable" + content: "from collections import (\n Bad,\n Good,\n )\n from collections.abc import Mapping, Callable" location: row: 37 column: 4 @@ -339,9 +312,7 @@ expression: diagnostics row: 44 column: 49 fix: - content: - - "from typing import Match, Pattern, List" - - from collections.abc import Callable + content: "from typing import Match, Pattern, List\nfrom collections.abc import Callable" location: row: 44 column: 0 @@ -363,9 +334,7 @@ expression: diagnostics row: 44 column: 49 fix: - content: - - "from typing import Callable, List" - - "from re import Match, Pattern" + content: "from typing import Callable, List\nfrom re import Match, Pattern" location: row: 44 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_0.py.snap index 7901e17259..b9de62a0d8 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_0.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 3 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 14 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 8 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 17 column: 19 fix: - content: - - "print(\"PY3!\")" + content: "print(\"PY3!\")" location: row: 16 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 23 column: 20 fix: - content: - - " print(\"PY3\")" + content: " print(\"PY3\")" location: row: 20 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 27 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 25 column: 0 @@ -101,10 +96,7 @@ expression: diagnostics row: 35 column: 30 fix: - content: - - "def f():" - - " print(\"py3\")" - - " print(\"This the next\")" + content: "def f():\n print(\"py3\")\n print(\"This the next\")" location: row: 29 column: 0 @@ -121,8 +113,7 @@ expression: diagnostics row: 40 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 37 column: 0 @@ -139,8 +130,7 @@ expression: diagnostics row: 48 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 45 column: 0 @@ -157,8 +147,7 @@ expression: diagnostics row: 54 column: 18 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 53 column: 0 @@ -175,8 +164,7 @@ expression: diagnostics row: 59 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 56 column: 0 @@ -193,8 +181,7 @@ expression: diagnostics row: 65 column: 20 fix: - content: - - " print(\"py3\")" + content: " print(\"py3\")" location: row: 62 column: 0 @@ -211,8 +198,7 @@ expression: diagnostics row: 70 column: 16 fix: - content: - - "print(\"py3\")" + content: "print(\"py3\")" location: row: 67 column: 0 @@ -229,8 +215,7 @@ expression: diagnostics row: 79 column: 13 fix: - content: - - " yield" + content: " yield" location: row: 73 column: 0 @@ -247,9 +232,7 @@ expression: diagnostics row: 91 column: 16 fix: - content: - - " def f(py3):" - - " pass" + content: " def f(py3):\n pass" location: row: 86 column: 0 @@ -266,8 +249,7 @@ expression: diagnostics row: 100 column: 9 fix: - content: - - " 3" + content: " 3" location: row: 97 column: 0 @@ -284,11 +266,7 @@ expression: diagnostics row: 113 column: 20 fix: - content: - - "def f():" - - " print(\"py3\")" - - "def g():" - - " print(\"py3\")" + content: "def f():\n print(\"py3\")\ndef g():\n print(\"py3\")" location: row: 104 column: 0 @@ -305,8 +283,7 @@ expression: diagnostics row: 117 column: 16 fix: - content: - - " print(3)" + content: " print(3)" location: row: 116 column: 0 @@ -323,8 +300,7 @@ expression: diagnostics row: 122 column: 40 fix: - content: - - print(3) + content: print(3) location: row: 122 column: 4 @@ -341,8 +317,7 @@ expression: diagnostics row: 126 column: 16 fix: - content: - - " print(3)" + content: " print(3)" location: row: 125 column: 0 @@ -359,12 +334,7 @@ expression: diagnostics row: 137 column: 9 fix: - content: - - " expected_error = [" - - "\":1:5: Generator expression must be parenthesized\"," - - "\"max(1 for i in range(10), key=lambda x: x+1)\"," - - "\" ^\"," - - " ]" + content: " expected_error = [\n\":1:5: Generator expression must be parenthesized\",\n\"max(1 for i in range(10), key=lambda x: x+1)\",\n\" ^\",\n ]" location: row: 130 column: 0 @@ -381,12 +351,7 @@ expression: diagnostics row: 147 column: 5 fix: - content: - - "expected_error = [" - - "\":1:5: Generator expression must be parenthesized\"," - - "\"max(1 for i in range(10), key=lambda x: x+1)\"," - - "\" ^\"," - - "]" + content: "expected_error = [\n\":1:5: Generator expression must be parenthesized\",\n\"max(1 for i in range(10), key=lambda x: x+1)\",\n\" ^\",\n]" location: row: 140 column: 0 @@ -403,18 +368,7 @@ expression: diagnostics row: 161 column: 28 fix: - content: - - "\"\"\"this" - - "is valid\"\"\"" - - "" - - "\"\"\"the indentation on" - - " this line is significant\"\"\"" - - "" - - "\"this is\" \\" - - " \"allowed too\"" - - "" - - "(\"so is\"" - - " \"this for some reason\")" + content: "\"\"\"this\nis valid\"\"\"\n\n\"\"\"the indentation on\n this line is significant\"\"\"\n\n\"this is\" \\\n \"allowed too\"\n\n(\"so is\"\n \"this for some reason\")" location: row: 150 column: 0 @@ -431,9 +385,7 @@ expression: diagnostics row: 164 column: 6 fix: - content: - - "expected_error = \\" - - " []" + content: "expected_error = \\\n []" location: row: 163 column: 0 @@ -450,8 +402,7 @@ expression: diagnostics row: 166 column: 49 fix: - content: - - "expected_error = []" + content: "expected_error = []" location: row: 166 column: 0 @@ -468,8 +419,7 @@ expression: diagnostics row: 169 column: 23 fix: - content: - - "expected_error = []" + content: "expected_error = []" location: row: 168 column: 0 @@ -486,9 +436,7 @@ expression: diagnostics row: 173 column: 6 fix: - content: - - "expected_error = \\" - - " []" + content: "expected_error = \\\n []" location: row: 172 column: 4 @@ -505,8 +453,7 @@ expression: diagnostics row: 176 column: 53 fix: - content: - - "expected_error = []" + content: "expected_error = []" location: row: 176 column: 4 @@ -523,8 +470,7 @@ expression: diagnostics row: 180 column: 23 fix: - content: - - " expected_error = []" + content: " expected_error = []" location: row: 179 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_1.py.snap index 6843a57dfb..9b4af647b5 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_1.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 6 column: 5 fix: - content: - - "3" + content: "3" location: row: 3 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 11 column: 5 fix: - content: - - "3" + content: "3" location: row: 8 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 16 column: 5 fix: - content: - - "3" + content: "3" location: row: 13 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 21 column: 5 fix: - content: - - "3" + content: "3" location: row: 18 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 26 column: 5 fix: - content: - - "3" + content: "3" location: row: 23 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 31 column: 5 fix: - content: - - "3" + content: "3" location: row: 28 column: 0 @@ -119,8 +113,7 @@ expression: diagnostics row: 38 column: 5 fix: - content: - - "3" + content: "3" location: row: 35 column: 0 @@ -137,8 +130,7 @@ expression: diagnostics row: 45 column: 12 fix: - content: - - "" + content: "" location: row: 42 column: 0 @@ -155,9 +147,7 @@ expression: diagnostics row: 52 column: 12 fix: - content: - - "else:" - - " print(3)" + content: "else:\n print(3)" location: row: 49 column: 0 @@ -174,9 +164,7 @@ expression: diagnostics row: 57 column: 12 fix: - content: - - "else:" - - " print(3)" + content: "else:\n print(3)" location: row: 56 column: 0 @@ -193,9 +181,7 @@ expression: diagnostics row: 63 column: 16 fix: - content: - - "else:" - - " print(3)" + content: "else:\n print(3)" location: row: 62 column: 4 @@ -212,8 +198,7 @@ expression: diagnostics row: 70 column: 12 fix: - content: - - "" + content: "" location: row: 67 column: 0 @@ -230,9 +215,7 @@ expression: diagnostics row: 76 column: 16 fix: - content: - - "else:" - - " print(3)" + content: "else:\n print(3)" location: row: 75 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_2.py.snap index 8e69bff877..e3c31ee7da 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_2.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 7 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 4 column: 0 @@ -29,8 +28,7 @@ expression: diagnostics row: 12 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 9 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 17 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 14 column: 0 @@ -65,8 +62,7 @@ expression: diagnostics row: 22 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 19 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 27 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 24 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 32 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 29 column: 0 @@ -119,8 +113,7 @@ expression: diagnostics row: 37 column: 7 fix: - content: - - 3+6 + content: 3+6 location: row: 34 column: 0 @@ -137,8 +130,7 @@ expression: diagnostics row: 40 column: 8 fix: - content: - - pass + content: pass location: row: 39 column: 0 @@ -155,8 +147,7 @@ expression: diagnostics row: 43 column: 8 fix: - content: - - "" + content: "" location: row: 42 column: 0 @@ -173,8 +164,7 @@ expression: diagnostics row: 47 column: 12 fix: - content: - - pass + content: pass location: row: 46 column: 4 @@ -191,8 +181,7 @@ expression: diagnostics row: 52 column: 8 fix: - content: - - "" + content: "" location: row: 49 column: 0 @@ -209,8 +198,7 @@ expression: diagnostics row: 57 column: 8 fix: - content: - - pass + content: pass location: row: 54 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_3.py.snap index a5bf7c351c..30487b708f 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_3.py.snap @@ -11,10 +11,7 @@ expression: diagnostics row: 10 column: 28 fix: - content: - - "print(\"py3\")" - - "for item in range(10):" - - " print(f\"PY3-{item}\")" + content: "print(\"py3\")\nfor item in range(10):\n print(f\"PY3-{item}\")" location: row: 3 column: 0 @@ -31,10 +28,7 @@ expression: diagnostics row: 20 column: 32 fix: - content: - - " print(\"py3\")" - - " for item in range(10):" - - " print(f\"PY3-{item}\")" + content: " print(\"py3\")\n for item in range(10):\n print(f\"PY3-{item}\")" location: row: 13 column: 0 @@ -51,8 +45,7 @@ expression: diagnostics row: 24 column: 50 fix: - content: - - "print(\"PY3!\")" + content: "print(\"PY3!\")" location: row: 23 column: 0 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_4.py.snap index 8aa867ced9..b623c103af 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP036_4.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 5 column: 53 fix: - content: - - pass + content: pass location: row: 4 column: 4 @@ -29,8 +28,7 @@ expression: diagnostics row: 12 column: 53 fix: - content: - - "" + content: "" location: row: 11 column: 0 @@ -47,8 +45,7 @@ expression: diagnostics row: 20 column: 51 fix: - content: - - "" + content: "" location: row: 17 column: 4 @@ -65,8 +62,7 @@ expression: diagnostics row: 25 column: 53 fix: - content: - - "" + content: "" location: row: 24 column: 0 @@ -83,8 +79,7 @@ expression: diagnostics row: 28 column: 53 fix: - content: - - "" + content: "" location: row: 27 column: 0 @@ -101,8 +96,7 @@ expression: diagnostics row: 35 column: 51 fix: - content: - - "" + content: "" location: row: 32 column: 4 @@ -119,8 +113,7 @@ expression: diagnostics row: 40 column: 51 fix: - content: - - " cmd = [sys.executable, \"-m\", \"test\", \"-j0\"]" + content: " cmd = [sys.executable, \"-m\", \"test\", \"-j0\"]" location: row: 37 column: 0 @@ -137,8 +130,7 @@ expression: diagnostics row: 45 column: 51 fix: - content: - - "" + content: "" location: row: 42 column: 4 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP037.py.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP037.py.snap index c79e4f2638..efd2a6ad26 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP037.py.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP037.py.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 18 column: 22 fix: - content: - - MyClass + content: MyClass location: row: 18 column: 13 @@ -29,8 +28,7 @@ expression: diagnostics row: 18 column: 36 fix: - content: - - MyClass + content: MyClass location: row: 18 column: 27 @@ -47,8 +45,7 @@ expression: diagnostics row: 19 column: 16 fix: - content: - - MyClass + content: MyClass location: row: 19 column: 7 @@ -65,8 +62,7 @@ expression: diagnostics row: 22 column: 26 fix: - content: - - bool + content: bool location: row: 22 column: 20 @@ -83,8 +79,7 @@ expression: diagnostics row: 26 column: 20 fix: - content: - - str + content: str location: row: 26 column: 15 @@ -101,8 +96,7 @@ expression: diagnostics row: 26 column: 37 fix: - content: - - int + content: int location: row: 26 column: 32 @@ -119,8 +113,7 @@ expression: diagnostics row: 30 column: 18 fix: - content: - - MyClass + content: MyClass location: row: 30 column: 9 @@ -137,8 +130,7 @@ expression: diagnostics row: 32 column: 22 fix: - content: - - MyClass + content: MyClass location: row: 32 column: 13 @@ -155,8 +147,7 @@ expression: diagnostics row: 36 column: 16 fix: - content: - - MyClass + content: MyClass location: row: 36 column: 7 @@ -173,8 +164,7 @@ expression: diagnostics row: 40 column: 31 fix: - content: - - int + content: int location: row: 40 column: 26 @@ -191,8 +181,7 @@ expression: diagnostics row: 44 column: 35 fix: - content: - - int + content: int location: row: 44 column: 30 @@ -209,8 +198,7 @@ expression: diagnostics row: 47 column: 18 fix: - content: - - str + content: str location: row: 47 column: 13 @@ -227,8 +215,7 @@ expression: diagnostics row: 49 column: 12 fix: - content: - - str + content: str location: row: 49 column: 7 @@ -245,8 +232,7 @@ expression: diagnostics row: 51 column: 19 fix: - content: - - str + content: str location: row: 51 column: 14 @@ -263,8 +249,7 @@ expression: diagnostics row: 53 column: 17 fix: - content: - - str + content: str location: row: 53 column: 12 @@ -281,8 +266,7 @@ expression: diagnostics row: 55 column: 24 fix: - content: - - str + content: str location: row: 55 column: 19 @@ -299,8 +283,7 @@ expression: diagnostics row: 57 column: 24 fix: - content: - - str + content: str location: row: 57 column: 19 @@ -317,8 +300,7 @@ expression: diagnostics row: 59 column: 15 fix: - content: - - str + content: str location: row: 59 column: 10 @@ -335,8 +317,7 @@ expression: diagnostics row: 61 column: 27 fix: - content: - - MyClass + content: MyClass location: row: 61 column: 18 @@ -353,8 +334,7 @@ expression: diagnostics row: 63 column: 33 fix: - content: - - int + content: int location: row: 63 column: 28 @@ -371,8 +351,7 @@ expression: diagnostics row: 63 column: 49 fix: - content: - - str + content: str location: row: 63 column: 44 @@ -389,8 +368,7 @@ expression: diagnostics row: 65 column: 33 fix: - content: - - foo + content: foo location: row: 65 column: 28 @@ -407,8 +385,7 @@ expression: diagnostics row: 65 column: 40 fix: - content: - - int + content: int location: row: 65 column: 35 @@ -425,8 +402,7 @@ expression: diagnostics row: 65 column: 49 fix: - content: - - bar + content: bar location: row: 65 column: 44 @@ -443,8 +419,7 @@ expression: diagnostics row: 65 column: 56 fix: - content: - - str + content: str location: row: 65 column: 51 @@ -461,8 +436,7 @@ expression: diagnostics row: 67 column: 26 fix: - content: - - X + content: X location: row: 67 column: 23 @@ -479,8 +453,7 @@ expression: diagnostics row: 67 column: 42 fix: - content: - - foo + content: foo location: row: 67 column: 37 @@ -497,8 +470,7 @@ expression: diagnostics row: 67 column: 49 fix: - content: - - int + content: int location: row: 67 column: 44 @@ -515,8 +487,7 @@ expression: diagnostics row: 69 column: 17 fix: - content: - - X + content: X location: row: 69 column: 14 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index 4accc43afa..2c66d3090a 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -1,5 +1,5 @@ --- -source: src/rules/pyupgrade/mod.rs +source: crates/ruff/src/rules/pyupgrade/mod.rs expression: diagnostics --- - kind: @@ -34,8 +34,7 @@ expression: diagnostics row: 10 column: 27 fix: - content: - - datetime.UTC + content: datetime.UTC location: row: 10 column: 6 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap index c8f42f7aa0..b5e74afafb 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 34 column: 21 fix: - content: - - list + content: list location: row: 34 column: 17 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap index daaf2ac849..d4b5397212 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 34 column: 21 fix: - content: - - list + content: list location: row: 34 column: 17 @@ -31,8 +30,7 @@ expression: diagnostics row: 35 column: 12 fix: - content: - - list + content: list location: row: 35 column: 8 @@ -50,8 +48,7 @@ expression: diagnostics row: 42 column: 30 fix: - content: - - list + content: list location: row: 42 column: 26 @@ -69,8 +66,7 @@ expression: diagnostics row: 42 column: 41 fix: - content: - - list + content: list location: row: 42 column: 37 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index 0d84122c99..0250b3c4bd 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 40 column: 16 fix: - content: - - int | None + content: int | None location: row: 40 column: 3 diff --git a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index ae49de6334..fd253d6a64 100644 --- a/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -11,8 +11,7 @@ expression: diagnostics row: 40 column: 16 fix: - content: - - int | None + content: int | None location: row: 40 column: 3 @@ -29,8 +28,7 @@ expression: diagnostics row: 42 column: 47 fix: - content: - - "List[int] | List[str]" + content: "List[int] | List[str]" location: row: 42 column: 20 diff --git a/crates/ruff/src/rules/ruff/mod.rs b/crates/ruff/src/rules/ruff/mod.rs index 2b1b7f7063..891f7768a7 100644 --- a/crates/ruff/src/rules/ruff/mod.rs +++ b/crates/ruff/src/rules/ruff/mod.rs @@ -7,14 +7,15 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use rustc_hash::FxHashSet; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::settings::resolve_per_file_ignores; use crate::settings::types::PerFileIgnore; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::KeywordArgumentBeforeStarArgument, Path::new("RUF004.py"); "RUF004")] #[test_case(Rule::UnpackInsteadOfConcatenatingToCollectionLiteral, Path::new("RUF005.py"); "RUF005")] diff --git a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__RUF005_RUF005.py.snap index 950d79681e..88f222f6a6 100644 --- a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__RUF005_RUF005.py.snap @@ -13,8 +13,7 @@ expression: diagnostics row: 10 column: 21 fix: - content: - - "[1, 2, 3, *foo]" + content: "[1, 2, 3, *foo]" location: row: 10 column: 6 @@ -33,8 +32,7 @@ expression: diagnostics row: 12 column: 23 fix: - content: - - "(7, 8, 9, *zoob)" + content: "(7, 8, 9, *zoob)" location: row: 12 column: 7 @@ -53,8 +51,7 @@ expression: diagnostics row: 13 column: 26 fix: - content: - - "(*quux, 10, 11, 12)" + content: "(*quux, 10, 11, 12)" location: row: 13 column: 7 @@ -73,8 +70,7 @@ expression: diagnostics row: 15 column: 26 fix: - content: - - "[*spom, 13, 14, 15]" + content: "[*spom, 13, 14, 15]" location: row: 15 column: 7 @@ -93,8 +89,7 @@ expression: diagnostics row: 16 column: 36 fix: - content: - - "(\"we all say\", *yay())" + content: "(\"we all say\", *yay())" location: row: 16 column: 12 @@ -113,8 +108,7 @@ expression: diagnostics row: 17 column: 45 fix: - content: - - "(\"we all think\", *Fun().yay())" + content: "(\"we all think\", *Fun().yay())" location: row: 17 column: 13 @@ -133,8 +127,7 @@ expression: diagnostics row: 18 column: 44 fix: - content: - - "(\"we all feel\", *Fun.words)" + content: "(\"we all feel\", *Fun.words)" location: row: 18 column: 15 @@ -153,8 +146,7 @@ expression: diagnostics row: 20 column: 30 fix: - content: - - "[\"a\", \"b\", \"c\", *eggs]" + content: "[\"a\", \"b\", \"c\", *eggs]" location: row: 20 column: 8 @@ -173,8 +165,7 @@ expression: diagnostics row: 20 column: 67 fix: - content: - - "(\"yes\", \"no\", \"pants\", *zoob)" + content: "(\"yes\", \"no\", \"pants\", *zoob)" location: row: 20 column: 38 @@ -193,8 +184,7 @@ expression: diagnostics row: 22 column: 15 fix: - content: - - "(*zoob,)" + content: "(*zoob,)" location: row: 22 column: 6 @@ -225,8 +215,7 @@ expression: diagnostics row: 41 column: 8 fix: - content: - - "[*foo]" + content: "[*foo]" location: row: 41 column: 0 @@ -245,8 +234,7 @@ expression: diagnostics row: 44 column: 8 fix: - content: - - "[*foo]" + content: "[*foo]" location: row: 44 column: 0 diff --git a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__confusables.snap b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__confusables.snap index fb72f6ef39..90a0e73578 100644 --- a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__confusables.snap +++ b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__confusables.snap @@ -1,5 +1,5 @@ --- -source: src/rules/ruff/mod.rs +source: crates/ruff/src/rules/ruff/mod.rs expression: diagnostics --- - kind: @@ -13,8 +13,7 @@ expression: diagnostics row: 1 column: 6 fix: - content: - - B + content: B location: row: 1 column: 5 @@ -33,8 +32,7 @@ expression: diagnostics row: 6 column: 56 fix: - content: - - ) + content: ) location: row: 6 column: 55 @@ -53,8 +51,7 @@ expression: diagnostics row: 7 column: 62 fix: - content: - - / + content: / location: row: 7 column: 61 diff --git a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_0.snap b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_0.snap index f7b5116a1b..f479a61b3b 100644 --- a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_0.snap @@ -1,5 +1,5 @@ --- -source: src/rules/ruff/mod.rs +source: crates/ruff/src/rules/ruff/mod.rs expression: diagnostics --- - kind: @@ -12,8 +12,7 @@ expression: diagnostics row: 9 column: 17 fix: - content: - - "" + content: "" location: row: 9 column: 9 @@ -35,8 +34,7 @@ expression: diagnostics row: 13 column: 23 fix: - content: - - "" + content: "" location: row: 13 column: 9 @@ -59,8 +57,7 @@ expression: diagnostics row: 16 column: 29 fix: - content: - - "" + content: "" location: row: 16 column: 9 @@ -84,8 +81,7 @@ expression: diagnostics row: 19 column: 35 fix: - content: - - "" + content: "" location: row: 19 column: 9 @@ -108,8 +104,7 @@ expression: diagnostics row: 22 column: 29 fix: - content: - - "" + content: "" location: row: 22 column: 9 @@ -131,8 +126,7 @@ expression: diagnostics row: 26 column: 21 fix: - content: - - "" + content: "" location: row: 26 column: 9 @@ -150,8 +144,7 @@ expression: diagnostics row: 29 column: 5 fix: - content: - - "" + content: "" location: row: 29 column: 0 @@ -173,8 +166,7 @@ expression: diagnostics row: 29 column: 44 fix: - content: - - "" + content: "" location: row: 29 column: 9 @@ -196,8 +188,7 @@ expression: diagnostics row: 55 column: 23 fix: - content: - - "# noqa: E501" + content: "# noqa: E501" location: row: 55 column: 5 @@ -219,8 +210,7 @@ expression: diagnostics row: 63 column: 17 fix: - content: - - "" + content: "" location: row: 63 column: 3 @@ -238,8 +228,7 @@ expression: diagnostics row: 71 column: 11 fix: - content: - - "" + content: "" location: row: 71 column: 3 @@ -259,8 +248,7 @@ expression: diagnostics row: 85 column: 13 fix: - content: - - "" + content: "" location: row: 85 column: 0 @@ -294,8 +282,7 @@ expression: diagnostics row: 90 column: 103 fix: - content: - - "" + content: "" location: row: 90 column: 89 diff --git a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_1.snap b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_1.snap index 218a351452..a1e231f228 100644 --- a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_1.snap @@ -1,5 +1,5 @@ --- -source: src/rules/ruff/mod.rs +source: crates/ruff/src/rules/ruff/mod.rs expression: diagnostics --- - kind: @@ -14,10 +14,7 @@ expression: diagnostics row: 37 column: 13 fix: - content: - - from typing import ( - - " Mapping, # noqa: F401" - - " )" + content: "from typing import (\n Mapping, # noqa: F401\n )" location: row: 35 column: 4 @@ -41,8 +38,7 @@ expression: diagnostics row: 52 column: 31 fix: - content: - - "" + content: "" location: row: 52 column: 17 @@ -64,8 +60,7 @@ expression: diagnostics row: 59 column: 31 fix: - content: - - "" + content: "" location: row: 59 column: 17 @@ -87,8 +82,7 @@ expression: diagnostics row: 66 column: 27 fix: - content: - - "" + content: "" location: row: 66 column: 13 @@ -110,8 +104,7 @@ expression: diagnostics row: 72 column: 38 fix: - content: - - "" + content: "" location: row: 72 column: 24 @@ -131,8 +124,7 @@ expression: diagnostics row: 89 column: 32 fix: - content: - - pass + content: pass location: row: 89 column: 4 @@ -152,8 +144,7 @@ expression: diagnostics row: 89 column: 52 fix: - content: - - pass + content: pass location: row: 89 column: 4 @@ -175,8 +166,7 @@ expression: diagnostics row: 89 column: 66 fix: - content: - - "" + content: "" location: row: 89 column: 52 diff --git a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_2.snap b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_2.snap index e4525487cd..98310cce37 100644 --- a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruf100_2.snap @@ -1,5 +1,5 @@ --- -source: src/rules/ruff/mod.rs +source: crates/ruff/src/rules/ruff/mod.rs expression: diagnostics --- - kind: @@ -16,8 +16,7 @@ expression: diagnostics row: 1 column: 30 fix: - content: - - "" + content: "" location: row: 1 column: 16 diff --git a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruff_targeted_noqa.snap b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruff_targeted_noqa.snap index 97cf442aa5..49786a6e1a 100644 --- a/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruff_targeted_noqa.snap +++ b/crates/ruff/src/rules/ruff/snapshots/ruff__rules__ruff__tests__ruff_targeted_noqa.snap @@ -12,8 +12,7 @@ expression: diagnostics row: 8 column: 5 fix: - content: - - pass + content: pass location: row: 8 column: 4 diff --git a/crates/ruff/src/rules/tryceratops/mod.rs b/crates/ruff/src/rules/tryceratops/mod.rs index a3b5b2bc60..a7e710439e 100644 --- a/crates/ruff/src/rules/tryceratops/mod.rs +++ b/crates/ruff/src/rules/tryceratops/mod.rs @@ -8,11 +8,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; + use crate::settings; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; #[test_case(Rule::RaiseVanillaClass, Path::new("TRY002.py"); "TRY002")] #[test_case(Rule::RaiseVanillaArgs, Path::new("TRY003.py"); "TRY003")] diff --git a/scripts/add_plugin.py b/scripts/add_plugin.py index f3b9e8724e..e30843f87d 100755 --- a/scripts/add_plugin.py +++ b/scripts/add_plugin.py @@ -36,11 +36,12 @@ mod tests { use std::path::Path; use anyhow::Result; + use insta::assert_yaml_snapshot; use test_case::test_case; use crate::registry::Rule; use crate::test::test_path; - use crate::{assert_yaml_snapshot, settings}; + use crate::settings; fn rules(rule_code: Rule, path: &Path) -> Result<()> { let snapshot = format!("{}_{}", rule_code.as_ref(), path.to_string_lossy());