sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.47k stars 432 forks source link

Sweep: Refactor sweepai/core/sweep_bot.py to remove commented out code and use traceback in error logs #1776

Open sweep-nightly[bot] opened 1 year ago

sweep-nightly[bot] commented 1 year ago

In the file sweepai/core/sweep_bot.py, there are several instances where the code does not conform to the user's rules.

  1. There is a large chunk of code that is commented out at line 24. This code should either be removed or uncommented and fixed if it is necessary.

  2. There are several instances where logger.warning is used without traceback during exceptions. These instances occur at lines 96, 102, 108, 114, 120, 126, 132, 138, 144, and 150. All of these should be refactored to include traceback for better error logging.

Checklist - [X] `sweepai/core/sweep_bot.py` ✅ Commit [`9455bc8`](https://github.com/sweepai/sweep/commit/9455bc85efa83997f1a21b8db6b6cfce0d642c88)
For each logger.warning call, include traceback information. This can be done by calling traceback.format_exc() and including the result in the logger.warning call. For example, change: logger.warning(e) to: logger.warning(f"{e}\n{traceback.format_exc()}") Apply this change to the logger.warning calls at lines 553, 680, 746, 759, 846, 874, 924, and 1294.
sweep-nightly[bot] commented 1 year ago

Here's the PR! https://github.com/sweepai/sweep/pull/1778.

💎 Sweep Pro: I'm creating this ticket using GPT-4. You have unlimited GPT-4 tickets.

Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/sweepai/sweep/blob/4d649c03adca43cd06c55e9849d7c5163328f780/sweepai/core/sweep_bot.py#L1-L1421

Step 2: ⌨️ Coding

logger.warning(e)

to:

logger.warning(f"{e}\n{traceback.format_exc()}")

Apply this change to the logger.warning calls at lines 553, 680, 746, 759, 846, 874, 924, and 1294.


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/refactor-sweep-bot.

.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord