Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit d6c581d

Browse files
authored
add instructions for inclusive line number ranges (#172)
1 parent 3bc4ba3 commit d6c581d

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

dist/index.js

Lines changed: 24 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/review.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ Format for changes:
390390
---end_change_section---
391391
...
392392
393+
The above format for changes consistes of multiple change sections.
394+
Each change section consists of a new hunk (annotated with line numbers),
395+
an old hunk (that was replaced with new hunk) and optionally, comment
396+
chains for context.
397+
393398
Hunks for review are below:
394399
`
395400

@@ -485,25 +490,29 @@ ${comment_chain}
485490
// add instructions
486491
ins.patches += `
487492
Instructions for you:
488-
- Only respond in the below response format consisting of multiple review
489-
sections and nothing else. Each review section must consist of a line
493+
- Your task is to do a line by line review of new hunks and point out
494+
substantive issues in those line number ranges. When commenting,
495+
you will need to provide the exact line number range (inclusive)
496+
for each issue that is detected.
497+
- Only respond in the below response format (consisting of review
498+
sections) and nothing else. Each review section must consist of a line
490499
number range and a comment for that line number range. Optionally,
491500
you can include replacement suggestion or new code snippets in the
492501
review comment. There's a separator between review sections.
493502
- It's important that line number ranges for each review section must
494503
be within the line number range of a specific new hunk. i.e.
495504
<start_line_number> must belong to the same hunk as the
496505
<end_line_number>. The line number range is sufficient to map your
497-
comment to the correct sections in GitHub pull request.
506+
comment to the code changes in GitHub pull request.
498507
- Consider the context provided by the old hunk and associated comment
499508
chain when reviewing the new hunk.
500509
- Use Markdown format for review comment text.
501510
- Fenced code blocks must be used for new content and replacement
502511
code/text snippets.
503512
- If needed, provide a replacement suggestion using fenced code blocks
504513
with the \`suggestion\` as the language identifier. The line number range
505-
in the review section must map exactly to the line number range that need
506-
to be replaced within a new_hunk_for_review. These snippets will be
514+
in the review section must map exactly to the line number range (inclusive)
515+
that need to be replaced within a new_hunk_for_review. These snippets will be
507516
directly committed by the user using the GitHub UI. For instance,
508517
if 2 lines of code in a hunk need to be replaced with 15 lines of code,
509518
the line number range must be those exact 2 lines. If an entire hunk need
@@ -513,7 +522,6 @@ Instructions for you:
513522
fenced code blocks. These snippets may be added to a different file, such
514523
as test cases.
515524
- Do not annotate code snippets with line numbers inside the code blocks.
516-
- In your response, focus only on pointing out substantive issues in the hunks
517525
and nothing else.
518526
- If there are no issues in a hunk, comment "LGTM!" for the respective line range.
519527
- Review your comments and line number ranges at least 3 times before sending
@@ -538,7 +546,7 @@ Response format expected:
538546
---
539547
...
540548
541-
Example request:
549+
Example changes:
542550
---new_hunk_for_review---
543551
1: def add(x, y):
544552
2: z = x+y

0 commit comments

Comments
 (0)