aider: Add LintResult class to linter.py.

# Aider chat conversation:

USER: create LinkResult

ASSISTANT: To create the `LintResult` class, we need to add it to the `aider/linter.py` file. Here is the *SEARCH/REPLACE* block to add the `LintResult` class:

aider/linter.py
```python
<<<<<<< SEARCH
from pathlib import Path
=======
from pathlib import Path
from dataclasses import dataclass
>>>>>>> REPLACE
```

aider/linter.py
```python
<<<<<<< SEARCH
def lint_python_compile(fname, code):
=======
@dataclass
class LintResult:
    text: str
    lines: list

def lint_python_compile(fname, code):
>>>>>>> REPLACE
```
This commit is contained in:
Paul Gauthier 2024-05-18 20:44:07 -07:00
parent 24e98a4ac2
commit 84edf3039c

View file

@ -4,6 +4,7 @@ import sys
import traceback import traceback
import warnings import warnings
from pathlib import Path from pathlib import Path
from dataclasses import dataclass
from grep_ast import TreeContext, filename_to_lang from grep_ast import TreeContext, filename_to_lang
from tree_sitter_languages import get_parser # noqa: E402 from tree_sitter_languages import get_parser # noqa: E402
@ -105,6 +106,12 @@ class Linter:
return result return result
@dataclass
class LintResult:
text: str
lines: list
def lint_python_compile(fname, code): def lint_python_compile(fname, code):
try: try:
compile(code, fname, "exec") # USE TRACEBACK BELOW HERE compile(code, fname, "exec") # USE TRACEBACK BELOW HERE