mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
Prompt user to fix lint errors before committing changes
This commit is contained in:
parent
f62e5bd883
commit
05ee45c31f
2 changed files with 13 additions and 15 deletions
|
@ -251,12 +251,14 @@ class Commands:
|
||||||
if not errors:
|
if not errors:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
self.io.tool_error(errors)
|
||||||
|
if not self.io.confirm_ask(f"Fix lint errors in {fname}?", default="y"):
|
||||||
|
continue
|
||||||
|
|
||||||
# Commit everything before we start fixing lint errors
|
# Commit everything before we start fixing lint errors
|
||||||
if self.coder.repo.is_dirty():
|
if self.coder.repo.is_dirty():
|
||||||
self.cmd_commit("")
|
self.cmd_commit("")
|
||||||
|
|
||||||
self.io.tool_error(errors)
|
|
||||||
|
|
||||||
if not lint_coder:
|
if not lint_coder:
|
||||||
lint_coder = self.coder.clone(
|
lint_coder = self.coder.clone(
|
||||||
# Clear the chat history, fnames
|
# Clear the chat history, fnames
|
||||||
|
|
|
@ -509,16 +509,8 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
utils.show_messages(messages)
|
utils.show_messages(messages)
|
||||||
return
|
return
|
||||||
|
|
||||||
if args.commit:
|
|
||||||
if args.dry_run:
|
|
||||||
io.tool_output("Dry run enabled, skipping commit.")
|
|
||||||
else:
|
|
||||||
coder.commands.cmd_commit()
|
|
||||||
return
|
|
||||||
|
|
||||||
if args.lint:
|
if args.lint:
|
||||||
coder.commands.cmd_lint(fnames=fnames)
|
coder.commands.cmd_lint(fnames=fnames)
|
||||||
return
|
|
||||||
|
|
||||||
if args.test:
|
if args.test:
|
||||||
if not args.test_cmd:
|
if not args.test_cmd:
|
||||||
|
@ -527,6 +519,14 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
test_errors = coder.commands.cmd_test(args.test_cmd)
|
test_errors = coder.commands.cmd_test(args.test_cmd)
|
||||||
if test_errors:
|
if test_errors:
|
||||||
coder.run(test_errors)
|
coder.run(test_errors)
|
||||||
|
|
||||||
|
if args.commit:
|
||||||
|
if args.dry_run:
|
||||||
|
io.tool_output("Dry run enabled, skipping commit.")
|
||||||
|
else:
|
||||||
|
coder.commands.cmd_commit()
|
||||||
|
|
||||||
|
if args.lint or args.test or args.commit:
|
||||||
return
|
return
|
||||||
|
|
||||||
if args.show_repo_map:
|
if args.show_repo_map:
|
||||||
|
@ -589,11 +589,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
coder.run()
|
coder.run()
|
||||||
return
|
return
|
||||||
except SwitchCoder as switch:
|
except SwitchCoder as switch:
|
||||||
coder = Coder.create(
|
coder = Coder.create(io=io, from_coder=coder, **switch.kwargs)
|
||||||
io=io,
|
|
||||||
from_coder=coder,
|
|
||||||
**switch.kwargs
|
|
||||||
)
|
|
||||||
coder.show_announcements()
|
coder.show_announcements()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue