From 828a5264b0f9ee6f99b4fb67a1cf7a45780806b3 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 18 May 2024 19:28:59 -0700 Subject: [PATCH] Updated linter to display relevant error lines and context. --- aider/linter.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aider/linter.py b/aider/linter.py index cc247b6c3..3a62fad72 100644 --- a/aider/linter.py +++ b/aider/linter.py @@ -21,8 +21,9 @@ class Linter: py_cmd = f"flake8 --select={fatal} --show-source" # noqa: F841 self.languages = dict( - # python=self.py_lint, - python="/Users/gauthier/Projects/aider/tmp.sh" + python=self.py_lint, + #python="/Users/gauthier/Projects/aider/tmp.sh" + #python="flake8 --show-source" ) def set_linter(self, lang, cmd): @@ -97,7 +98,8 @@ def lint_python_compile(fname, code): tb_lines = tb_lines[:1] + tb_lines[last_file_i + 1 :] - res = "".join(tb_lines) + res = "# Fix this error:\n\n" + res += "".join(tb_lines) res += "\n" res += tree_context(fname, code, line_numbers) return res @@ -140,7 +142,7 @@ def tree_context(fname, code, line_nums): context.add_lines_of_interest(line_nums) context.add_context() s = "s" if len(line_nums) > 1 else "" - output = f"# Fix the error{s}, see relevant line{s} below marked with █.\n\n" + output = f"## See relevant line{s} below marked with █.\n\n" output += fname + ":\n" output += context.format()