MCPcopy Create free account
hub / github.com/astral-sh/ruff / check_fstring_comments

Method check_fstring_comments

crates/ruff_python_parser/src/parser/expression.rs:1603–1622  ·  view source on GitHub ↗

Check `range` for comment tokens, report an `UnsupportedSyntaxError` for each one found, and return whether any comments were found.

(&mut self, range: TextRange)

Source from the content-addressed store, hash-verified

1601 /// Check `range` for comment tokens, report an `UnsupportedSyntaxError` for each one found,
1602 /// and return whether any comments were found.
1603 fn check_fstring_comments(&mut self, range: TextRange) -> bool {
1604 let mut has_comments = false;
1605
1606 self.unsupported_syntax_errors.extend(
1607 self.tokens
1608 .in_range(range)
1609 .iter()
1610 .filter(|token| token.kind().is_comment())
1611 .map(|token| {
1612 has_comments = true;
1613 UnsupportedSyntaxError {
1614 kind: UnsupportedSyntaxErrorKind::Pep701FString(FStringKind::Comment),
1615 range: token.range(),
1616 target_version: self.options.target_version,
1617 }
1618 }),
1619 );
1620
1621 has_comments
1622 }
1623
1624 /// Parses a list of f/t-string elements.
1625 ///

Callers 1

Calls 8

extendMethod · 0.45
mapMethod · 0.45
filterMethod · 0.45
iterMethod · 0.45
in_rangeMethod · 0.45
is_commentMethod · 0.45
kindMethod · 0.45
rangeMethod · 0.45

Tested by

no test coverage detected