Aller directement au contenu principal

openhands.linter.base

LintResult Objects

class LintResult(BaseModel)

line

1-indexed

column

1-indexed

visualize

def visualize(half_window: int = 3) -> str

Visualize the lint result by print out all the lines where the lint result is found.

Arguments:

  • half_window - The number of context lines to display around the error on each side.

LinterException Objects

class LinterException(Exception)

Base class for all linter exceptions.

BaseLinter Objects

class BaseLinter(ABC)

Base class for all linters.

Each linter should be able to lint files of a specific type and return a list of (parsed) lint results.

supported_extensions

@property
@abstractmethod
def supported_extensions() -> list[str]

The file extensions that this linter supports, such as .py or .tsx.

lint

@abstractmethod
def lint(file_path: str) -> list[LintResult]

Lint the given file.

file_path: The path to the file to lint. Required to be absolute.