Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test #3783

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion sweepai/core/review_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,16 @@ def review_code_issues_by_file(self, pr_changes: list[PRChange], formatted_pr_ch
"messages": [{"role": message.role, "content": message.content} for message in self.messages],
"output": "END OF MESSAGES",
})
return code_reviews_by_file
return code_reviews_by_file

# adds line numbers to a string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweep has identified a redundant function: The new add_line_numbers_to_text function is useless because its exact functionality is already provided by the existing add_line_numbers function in str_utils.py.

def add_line_numbers_to_text(content: str):
content_lines = content.split("\n")
new_content = [f"{i} {line}" for i, line in enumerate(content_lines)]
return "\n".join(new_content)

if __name__ == "__main__":
test_text = """hello
this is some test text to
be numbered"""
print(add_line_numbers_to_text(test_text))
Loading