ruff/crates/ruff_linter/resources/test/fixtures
Steve C f6b6f0df67
[`ruff`] Fix panic in unused `# noqa` removal with multi-byte space (`RUF100`) (#10682)
## Summary

Currently, [this
line](716688d44e/crates/ruff_linter/src/fix/edits.rs (L101))
assumes that the `noqa` comment begins with an octothorpe followed by a
space. (`# `) With anyone's random code, this of course is not always
true.

When there's a multi-byte character after the leading octothorpe, such
as
[`\u0085`](https://www.fileformat.info/info/unicode/char/85/index.htm),
we try slicing from within the character, causing a panic.

To fix this, the logic has been changed to remove unused `noqa`
directives and keep any trailing comments, or removing the whole comment
if the comment is just the unused `noqa`

Fixes #10097.

## Test Plan

`cargo test`
2024-04-01 01:00:37 +00:00
..
airflow Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
control-flow-graph Add erroneous for-loop test case for CFG (#8957) 2023-12-01 23:11:42 +00:00
eradicate Avoid code comment detection in PEP 723 script tags (#10464) 2024-03-18 17:48:51 -04:00
filesystem Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_2020 Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_annotations Handle raises with implicit alternate branches (#9377) 2024-01-02 22:59:12 -05:00
flake8_async [`flake8-async`] Take `pathlib.Path` into account when analyzing async functions (#9703) 2024-01-30 17:42:50 +00:00
flake8_bandit Use `ExprFString` for `StringLike::FString` variant (#10311) 2024-03-14 13:30:22 +05:30
flake8_blind_except Add `Expr::Name` checks to rules which use `is_logger_candidate` (#7521) 2023-09-27 00:21:22 +00:00
flake8_boolean_trap [`flake8-boolean-trap`] Add setting for user defined allowed boolean trap (#10531) 2024-03-30 00:26:12 +00:00
flake8_bugbear [`flake8-bugbear`] Avoid false positive for usage after `continue` (`B031`) (#10539) 2024-03-25 00:38:30 +00:00
flake8_builtins Restrict `builtin-attribute-shadowing` to actual shadowed references (#9462) 2024-01-11 12:59:40 -05:00
flake8_commas Consider the new f-string tokens for `flake8-commas` (#8582) 2023-11-10 09:49:14 +05:30
flake8_comprehensions [`flake8-comprehensions`] Handled special case for `C401` which also matches `C416` (#10596) 2024-03-26 03:54:58 +00:00
flake8_datetimez Allow f-strings with `%z` for `DTZ007` (#10651) 2024-03-29 09:57:13 +05:30
flake8_debugger Check for use of `debugpy` and `ptvsd` debug modules (#10177) (#10194) 2024-03-01 23:02:44 -05:00
flake8_django Respect `__str__` definitions from super classes (#9338) 2023-12-31 22:25:08 +00:00
flake8_errmsg Allow `EM` fixes even if `msg` variable is defined (#9059) 2023-12-08 15:16:15 -06:00
flake8_executable Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_fixme Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_future_annotations Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_gettext Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_implicit_str_concat Add support for PEP 701 (#7376) 2023-09-29 02:55:39 +00:00
flake8_import_conventions Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_logging Avoid failures due to non-deterministic binding ordering (#10478) 2024-03-19 18:01:33 +00:00
flake8_logging_format Add `Expr::Name` checks to rules which use `is_logger_candidate` (#7521) 2023-09-27 00:21:22 +00:00
flake8_no_pep420 Avoid missing namespace violations in scripts with shebangs (#8710) 2023-11-16 17:21:33 -05:00
flake8_pie Allow trailing ellipsis in `typing.TYPE_CHECKING` (#10413) 2024-03-15 03:55:57 +00:00
flake8_print Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_pyi Mark PYI025 fix as safe in more cases for stub files (#10547) 2024-03-24 16:11:48 +00:00
flake8_pytest_style Fix `PT014` autofix for last item in list (#10532) 2024-03-23 09:26:42 -04:00
flake8_quotes Ignore `Q000`, `Q001` when string is inside forward ref (#10585) 2024-03-25 18:52:59 +00:00
flake8_raise Avoid false-positives for parens-on-raise with futures.exception() (#10206) 2024-03-03 00:28:51 +00:00
flake8_return Skip empty lines when determining base indentation (#9795) 2024-02-02 19:42:47 +00:00
flake8_self Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_simplify [`flake8-simplify`] Detect implicit `else` cases in `needless-bool` (`SIM103`) (#10414) 2024-03-18 00:15:28 +00:00
flake8_slots Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_tidy_imports Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_todos Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_trio Avoid `TRIO115` if the argument is a variable (#10376) 2024-03-13 13:09:18 +05:30
flake8_type_checking Recategorize `runtime-string-union` to `TCH010` (#9721) 2024-02-01 13:35:02 -06:00
flake8_unused_arguments Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
flake8_use_pathlib Show custom message for `Path.joinpath` with starred arguments (#7852) 2023-10-09 12:04:35 +00:00
flynt Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
isort Always place non-relative imports after relative imports (#10669) 2024-03-29 22:13:54 -04:00
mccabe Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
numpy Add `row_stack` to NumPy 2.0 migration rule (#10646) 2024-03-28 09:49:40 -04:00
pandas_vet Limit inplace diagnostics to methods that accept inplace (#9495) 2024-01-12 14:12:54 -05:00
pep8_naming [`pep8_naming`] Add fixes `N804` and `N805` (#10215) 2024-03-04 02:22:54 +00:00
perflint [`perflint`] Catch a wider range of mutations in `PERF101` (#9955) 2024-02-12 12:17:55 -05:00
pycodestyle [`pycodestyle`] Avoid blank line rules for the first logical line in cell (#10291) 2024-03-25 11:19:30 +00:00
pydocstyle [`pydocstyle`] Trim whitespace when removing blank lines after section (`D413`) (#10162) 2024-02-29 13:29:40 +00:00
pyflakes Fix F821 false negatives when `from __future__ import annotations` is active (attempt 2) (#10524) 2024-03-22 18:11:16 +00:00
pygrep_hooks Redirect `PHG001` to `S307` and `PGH002` to `G010` (#9756) 2024-02-01 13:35:02 -06:00
pylint [`pylint`] Implement `modified-iterating-set` (`E4703`) (#10473) 2024-03-31 14:37:49 +00:00
pyupgrade Avoid failures due to non-deterministic binding ordering (#10478) 2024-03-19 18:01:33 +00:00
refurb [`refurb`] Implement `unnecessary-from-float` (`FURB164`) (#10647) 2024-03-30 07:04:01 -04:00
ruff [`ruff`] Fix panic in unused `# noqa` removal with multi-byte space (`RUF100`) (#10682) 2024-04-01 01:00:37 +00:00
tryceratops Avoid failures due to non-deterministic binding ordering (#10478) 2024-03-19 18:01:33 +00:00
__init__.py [`pylint`] (Re-)Implement `import-private-name` (`C2701`) (#9553) 2024-01-16 14:03:11 -05:00