Results

class LintViolation[source]

An individual lint error, with an optional replacement and expected diff.

rule_name: str
range: CodeRange | None
message: str
node: CSTNode
replacement: CSTNode | FlattenSentinel[CSTNode] | RemovalSentinel | None
diff: str
position_node: CSTNode | None
property autofixable: bool

Whether the violation includes a suggested replacement.

class Result[source]

A single lint result for a given file and lint rule.

path: Path
violation: LintViolation | None
error: tuple[Exception, str] | None = None
source: bytes | None = None
config: Config | None = None
classmethod from_exception(path, error, *, source=None, config=None)[source]
FileContent = <class 'bytes'>

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

class CodePosition[source]

CodePosition(line: int, column: int)

line: int

Line numbers are 1-indexed.

column: int

Column numbers are 0-indexed.

class CodeRange[source]

CodeRange(start: Union[Tuple[int, int], ForwardRef(‘CodePosition’)], end: Union[Tuple[int, int], ForwardRef(‘CodePosition’)])

start: CodePosition

Starting position of a node (inclusive).

end: CodePosition

Ending position of a node (exclusive).