ruff/crates
konsti 94b68f201b
Fix stylist indentation with a formfeed (#7489)
**Summary** In python, a formfeed is technically undefined behaviour
(https://docs.python.org/3/reference/lexical_analysis.html#indentation):
> A formfeed character may be present at the start of the line; it will
be ignored for
> the indentation calculations above. Formfeed characters occurring
elsewhere in the
> leading whitespace have an undefined effect (for instance, they may
reset the space
> count to zero).

In practice, they just reset the indentation:


df8b3a46a7/Parser/tokenizer.c (L1819-L1821)
a41bb2733f/crates/ruff_python_parser/src/lexer.rs (L664-L667)

The stylist didn't handle formfeeds previously and would produce invalid
indents. The remedy is to cut everything before a form feed.

Checks box for
https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458825

**Test Plan** Unit test for the stylist and a regression test for the
rule
2023-09-19 12:01:16 +02:00
..
flake8_to_ruff Move documentation to docs.astral.sh/ruff (#7419) 2023-09-15 22:49:42 -04:00
ruff Fix stylist indentation with a formfeed (#7489) 2023-09-19 12:01:16 +02:00
ruff_benchmark Bump mimalloc from 0.1.38 to 0.1.39 (#7402) 2023-09-15 08:46:55 +00:00
ruff_cache Error on zero tab width (#6429) 2023-08-08 16:51:37 -04:00
ruff_cli Move documentation to docs.astral.sh/ruff (#7419) 2023-09-15 22:49:42 -04:00
ruff_dev Use MkDocs' not_in_nav (#5498) 2023-09-19 00:01:43 +00:00
ruff_diagnostics Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
ruff_formatter Add optimized best_fit_parenthesize IR (#7475) 2023-09-19 06:29:05 +00:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Update rule selection to respect preview mode (#7195) 2023-09-11 12:28:39 -05:00
ruff_notebook chore: Upgrade pyproject-toml crate (#7335) 2023-09-13 17:55:03 +02:00
ruff_python_ast Use CommentRanges in backwards lexing (#7360) 2023-09-16 03:21:45 +00:00
ruff_python_codegen Fix stylist indentation with a formfeed (#7489) 2023-09-19 12:01:16 +02:00
ruff_python_formatter Add optimized best_fit_parenthesize IR (#7475) 2023-09-19 06:29:05 +00:00
ruff_python_index Remove triple-quoted string ranges computation (#7476) 2023-09-18 20:57:49 +05:30
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 Add range to lexer test snapshots (#7265) 2023-09-11 19:12:46 +00: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 Avoid flagging starred expressions in UP007 (#7505) 2023-09-19 03:37:38 +00:00
ruff_python_stdlib [flake8-logging] Implement LOG002: invalid-get-logger-argument (#7399) 2023-09-16 12:21:30 -04:00
ruff_python_trivia Modify comment_ranges slice in BackwardsTokenizer (#7432) 2023-09-16 14:04:45 -04:00
ruff_shrinking Bump shlex from 1.1.0 to 1.2.0 (#7381) 2023-09-14 09:40:05 -05:00
ruff_source_file Use dot references in docs for methods (#7391) 2023-09-14 14:35:34 -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 Use CommentRanges in backwards lexing (#7360) 2023-09-16 03:21:45 +00:00
ruff_workspace [refurb] Implement reimplemented-starmap rule (FURB140) (#7253) 2023-09-19 02:18:54 +00:00