mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 12:20:38 +08:00
grammar
This commit is contained in:
@ -23,7 +23,10 @@ def extend_patch(original_file_str, patch_str, num_lines) -> str:
|
|||||||
return patch_str
|
return patch_str
|
||||||
|
|
||||||
if type(original_file_str) == bytes:
|
if type(original_file_str) == bytes:
|
||||||
|
try:
|
||||||
original_file_str = original_file_str.decode('utf-8')
|
original_file_str = original_file_str.decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
return ""
|
||||||
|
|
||||||
original_lines = original_file_str.splitlines()
|
original_lines = original_file_str.splitlines()
|
||||||
patch_lines = patch_str.splitlines()
|
patch_lines = patch_str.splitlines()
|
||||||
|
@ -146,6 +146,9 @@ def pr_generate_extended_diff(pr_languages: list,
|
|||||||
|
|
||||||
# extend each patch with extra lines of context
|
# extend each patch with extra lines of context
|
||||||
extended_patch = extend_patch(original_file_content_str, patch, num_lines=patch_extra_lines)
|
extended_patch = extend_patch(original_file_content_str, patch, num_lines=patch_extra_lines)
|
||||||
|
if not extend_patch:
|
||||||
|
get_logger().warning(f"Failed to extend patch for file: {file.filename}")
|
||||||
|
continue
|
||||||
full_extended_patch = f"\n\n## {file.filename}\n\n{extended_patch}\n"
|
full_extended_patch = f"\n\n## {file.filename}\n\n{extended_patch}\n"
|
||||||
|
|
||||||
if add_line_numbers_to_hunks:
|
if add_line_numbers_to_hunks:
|
||||||
|
@ -44,6 +44,7 @@ default = [
|
|||||||
'ss',
|
'ss',
|
||||||
'svg',
|
'svg',
|
||||||
'tar',
|
'tar',
|
||||||
|
'tgz',
|
||||||
'tsv',
|
'tsv',
|
||||||
'ttf',
|
'ttf',
|
||||||
'war',
|
'war',
|
||||||
|
Reference in New Issue
Block a user