summaryrefslogtreecommitdiffstats
path: root/etc/tool/copilot.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-24 01:05:29 +0100
committerGitHub <noreply@github.com>2024-01-24 01:05:29 +0100
commit71d71b6512df12d6295c1f8323eb056edd89c57f (patch)
treedb88f2c8237b51519401e077df059b71f41e6404 /etc/tool/copilot.py
parentMerge pull request #1509 from hlohaus/sort (diff)
parentAdd get_connector helper (diff)
downloadgpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.gz
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.bz2
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.lz
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.xz
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.zst
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.zip
Diffstat (limited to '')
-rw-r--r--etc/tool/copilot.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/tool/copilot.py b/etc/tool/copilot.py
index 348b8bb8..ed1fdf16 100644
--- a/etc/tool/copilot.py
+++ b/etc/tool/copilot.py
@@ -126,6 +126,7 @@ def analyze_code(pull: PullRequest, diff: str)-> list[dict]:
for line in diff.split('\n'):
if line.startswith('+++ b/'):
current_file_path = line[6:]
+ changed_lines = []
elif line.startswith('@@'):
match = re.search(r'\+([0-9]+?),', line)
if match:
@@ -137,9 +138,10 @@ def analyze_code(pull: PullRequest, diff: str)-> list[dict]:
for review in response.get('reviews', []):
review['path'] = current_file_path
comments.append(review)
- changed_lines = []
current_file_path = None
- elif not line.startswith('-'):
+ elif line.startswith('-'):
+ changed_lines.append(line)
+ else:
changed_lines.append(f"{offset_line}:{line}")
offset_line += 1