Treat form feed as valid whitespace before a line continuation#19220
Treat form feed as valid whitespace before a line continuation#19220MichaReiser merged 6 commits intoastral-sh:mainfrom
Conversation
|
Thanks for working on this! Could you add a regression test based on the example in the issue? I'm slightly concerned that |
|
No problem! I had a similar thought about the is_whitespace check, but I couldn't find (with admittedly not a ton of time searching) a comprehensive list of all valid whitespace Python characters. If you have one handy, I'm happy to make the change to that -- in the meantime I'll keep looking for one myself. |
|
Section 2.1.9 “Whitespace between tokens” says:
Those are the only three characters Python treats as white space within a line. |
ntBre
left a comment
There was a problem hiding this comment.
Thanks, this looks great!
And thanks @dscorbett for the report and for the whitespace reference.
I just had a couple of very small suggestions, but this is good to go otherwise.
crates/ruff_linter/resources/test/fixtures/flake8_type_checking/whitespace.py
Show resolved
Hide resolved
| // space, tab, & formfeed (respectively) are the only three valid whitespace characters | ||
| // within a line: | ||
| // https://docs.python.org/3/reference/lexical_analysis.html#whitespace-between-tokens | ||
| ' ' | '\t' | '\u{000C}' => continue, |
There was a problem hiding this comment.
We could use
ruff/crates/ruff_python_trivia/src/whitespace.rs
Lines 40 to 46 in 9f3a38d
There was a problem hiding this comment.
thanks for lmk about this, updated to use this fn
|
Looks like we need to update the snapshot for the new comment |
|
Weird, i ran cargo insta review and it said no changes, also ran cargo test on my local and it was fine Happy to do whatever it takes here just let me know what to do, not super familiar with how the tests work yet |
|
Can you verify that you have no uncommited changes ( |
|
I checked out the branch locally and see the same test failures, so it might be something with git as Micha said. I can push a commit if you'd like but wanted to give you the solo credit for the PR if possible :) |
|
yep, nothing unstaged, no diffs, no snapshots to review |
…re_help * 'main' of https://github.com/astral-sh/ruff: Add simple integration tests for all output formats (astral-sh#19265) [`flake8-return`] Fix false-positive for variables used inside nested functions in `RET504` (astral-sh#18433) [ty] Add a `--quiet` mode (astral-sh#19233) Treat form feed as valid whitespace before a line continuation (astral-sh#19220) [ty] Make `check_file` a salsa query (astral-sh#19255) [ty] Consolidate submodule resolving code between `types.rs` and `ide_support.rs` (astral-sh#19256) [ty] Remove countme from salsa-structs (astral-sh#19257) [ty] Improve and document equivalence for module-literal types (astral-sh#19243) [ty] Optimize protocol subtyping by removing expensive and unnecessary equivalence check from the top of `Type::has_relation_to()` (astral-sh#19230) [ty] Ecosystem analyzer: parallelize, fix race condition (astral-sh#19252) [ty] Add completion kind to playground (astral-sh#19251) [ty] Deploy ecosystem diff to Cloudflare pages (astral-sh#19234) [ty] Add semantic token provider to playground (astral-sh#19232)
Fixes #19175