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

Method add_error

crates/ruff_python_parser/src/parser/mod.rs:661–680  ·  view source on GitHub ↗
(&mut self, error: ParseErrorType, ranged: T)

Source from the content-addressed store, hash-verified

659 }
660
661 fn add_error<T>(&mut self, error: ParseErrorType, ranged: T)
662 where
663 T: Ranged,
664 {
665 fn inner(errors: &mut Vec<ParseError>, error: ParseErrorType, range: TextRange) {
666 // Avoid flagging multiple errors at the same location
667 let is_same_location = errors
668 .last()
669 .is_some_and(|last| last.location.start() == range.start());
670
671 if !is_same_location {
672 errors.push(ParseError {
673 error,
674 location: range,
675 });
676 }
677 }
678
679 inner(&mut self.errors, error, ranged.range());
680 }
681
682 /// Add an [`UnsupportedSyntaxError`] with the given [`UnsupportedSyntaxErrorKind`] and
683 /// [`TextRange`] if its minimum version is less than [`Parser::target_version`].

Calls 2

innerFunction · 0.50
rangeMethod · 0.45

Tested by

no test coverage detected