ruff/crates/ruff_python_ast/src
Dylan 694e7ed52e
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Less confidently mark f-strings as empty when inferring truthiness (#20152)
When computing the boolean value of an f-string, we over-eagerly
interpreted some f-string interpolations as empty. In this PR we now
mark the truthiness of f-strings involving format specs, debug text, and
bytes literals as "unknown".

This will probably result in some false negatives, which may be further
refined (for example - there are probably many cases where
`is_not_empty_f_string` should be modified to return `true`), but for
now at least we should have fewer false positives.

Affected rules (may not be an exhaustive list):

- [unnecessary-empty-iterable-within-deque-call
(RUF037)](https://docs.astral.sh/ruff/rules/unnecessary-empty-iterable-within-deque-call/#unnecessary-empty-iterable-within-deque-call-ruf037)
- [falsy-dict-get-fallback
(RUF056)](https://docs.astral.sh/ruff/rules/falsy-dict-get-fallback/#falsy-dict-get-fallback-ruf056)
- [pytest-assert-always-false
(PT015)](https://docs.astral.sh/ruff/rules/pytest-assert-always-false/#pytest-assert-always-false-pt015)
- [expr-or-not-expr
(SIM221)](https://docs.astral.sh/ruff/rules/expr-or-not-expr/#expr-or-not-expr-sim221)
- [expr-or-true
(SIM222)](https://docs.astral.sh/ruff/rules/expr-or-true/#expr-or-true-sim222)
- [expr-and-false
(SIM223)](https://docs.astral.sh/ruff/rules/expr-and-false/#expr-and-false-sim223)

Closes #19935
2025-08-29 22:12:54 +00:00
..
visitor Disallow implicit concatenation of t-strings and other string types (#19485) 2025-07-27 12:41:03 +00:00
comparable.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
docstrings.rs
expression.rs Disallow implicit concatenation of t-strings and other string types (#19485) 2025-07-27 12:41:03 +00:00
generated.rs [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
helpers.rs Less confidently mark f-strings as empty when inferring truthiness (#20152) 2025-08-29 22:12:54 +00:00
identifier.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
int.rs [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
lib.rs [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
name.rs [ty] Reduce size of member table (#19572) 2025-08-07 11:16:04 +02:00
node.rs Disallow implicit concatenation of t-strings and other string types (#19485) 2025-07-27 12:41:03 +00:00
node_index.rs [ty] Shrink size of AstNodeRef (#20028) 2025-08-22 17:03:22 -04:00
nodes.rs [ty] Shrink size of AstNodeRef (#20028) 2025-08-22 17:03:22 -04:00
operator_precedence.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
parenthesize.rs Remove customizable reference enum names (#15647) 2025-01-21 13:46:31 -05:00
python_version.rs [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
relocate.rs [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
script.rs bump MSRV to 1.83 (#16294) 2025-02-26 06:12:43 -08:00
statement_visitor.rs
stmt_if.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
str.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
str_prefix.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
traversal.rs Use referencial equality in traversal helper methods (#13895) 2024-10-24 11:30:22 +02:00
types.rs
visitor.rs Disallow implicit concatenation of t-strings and other string types (#19485) 2025-07-27 12:41:03 +00:00
whitespace.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00