ruff/crates
Charlie Marsh 51d69b448c
Improve compatibility between multi-statement PYI rules (#7024)
## Summary

This PR modifies a few of our rules related to which statements (and how
many) are allowed in function bodies within `.pyi` files, to improve
compatibility with flake8-pyi and improve the interplay dynamics between
them. Each change fixes a deviation from flake8-pyi:

- We now always trigger the multi-statement rule (PYI048) regardless of
whether one of the statements is a docstring.
- We no longer trigger the `...` rule (PYI010) if the single statement
is a docstring or a `pass` (since those are covered by other rules).
- We no longer trigger the `...` rule (PYI010) if the function body
contains multiple statements (since that's covered by PYI048).

Closes https://github.com/astral-sh/ruff/issues/7021.

## Test Plan

`cargo test`
2023-08-31 21:45:26 +01:00
..
flake8_to_ruff Unify line size settings between ruff and the formatter (#6873) 2023-08-28 06:44:56 +00:00
ruff Improve compatibility between multi-statement PYI rules (#7024) 2023-08-31 21:45:26 +01:00
ruff_benchmark Add unicode benchmark (#7002) 2023-08-30 09:57:57 +02:00
ruff_cache Error on zero tab width (#6429) 2023-08-08 16:51:37 -04:00
ruff_cli Add hidden --preview / --no-preview options to ruff check (#7009) 2023-08-31 09:51:59 -05:00
ruff_dev Show changed files (#7003) 2023-08-30 06:47:45 +00:00
ruff_diagnostics Implement Ranged on more structs (#6921) 2023-08-27 19:03:08 +00:00
ruff_formatter Update dynamic_text builder doc comment (#6978) 2023-08-29 16:29:11 +02:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Move Configuration to ruff_workspace crate (#6920) 2023-08-28 06:21:35 +00:00
ruff_python_ast Fix WithItem ranges for parenthesized, non-as items (#6782) 2023-08-31 16:21:29 +01:00
ruff_python_codegen Make Parameters an optional field on ExprLambda (#6669) 2023-08-18 15:34:54 +00:00
ruff_python_formatter Allow tab_width to be configable (#7016) 2023-08-31 07:40:03 +00:00
ruff_python_index Move Ranged into ruff_text_size (#6919) 2023-08-27 14:12:51 -04:00
ruff_python_literal Avoid parsing other parts of a format specification if replacements are present (#6858) 2023-08-25 17:42:57 +00:00
ruff_python_parser Fix WithItem ranges for parenthesized, non-as items (#6782) 2023-08-31 16:21:29 +01:00
ruff_python_resolver Replace .map_or(false, $closure) with .is_some_and(closure) (#6244) 2023-08-01 19:29:42 +02:00
ruff_python_semantic Move refurb/helpers utils to ruff_python_semantic for broader use (#6990) 2023-08-29 14:45:09 -04:00
ruff_python_stdlib Add TOML files to SourceType (#6929) 2023-08-28 15:01:48 +00:00
ruff_python_trivia Implement Ranged on more structs (#6921) 2023-08-27 19:03:08 +00:00
ruff_shrinking Move Ranged into ruff_text_size (#6919) 2023-08-27 14:12:51 -04:00
ruff_source_file Allow Locator#slice to take Ranged (#6922) 2023-08-28 11:08:39 -04:00
ruff_text_size Unify line size settings between ruff and the formatter (#6873) 2023-08-28 06:44:56 +00:00
ruff_wasm Add hidden --preview / --no-preview options to ruff check (#7009) 2023-08-31 09:51:59 -05:00
ruff_workspace Add hidden --preview / --no-preview options to ruff check (#7009) 2023-08-31 09:51:59 -05:00