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

Commit 358f2ef

Browse files
authored
ask bot to double check it's work (#167)
1 parent 1829dbc commit 358f2ef

File tree

3 files changed

+79
-94
lines changed

3 files changed

+79
-94
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ inputs:
9898
- Consistency
9999
- Error handling
100100
- Maintainability
101-
- Code reuse
101+
- Modularity
102102
- Complexity
103103
- Optimization
104104

dist/index.js

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

src/review.ts

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -391,42 +391,26 @@ Format for changes:
391391
...
392392
393393
Instructions:
394-
- Only respond in the below response format and nothing else. Each review
395-
section must consist of a line number range and a comment for
396-
that line number range. Optionally, you can include replacement suggestion
397-
or new code snippets in the review comment. There's a separator between
398-
review sections.
399-
- It's important that line number ranges for each review section must
400-
be within the line number range of a specific new hunk. i.e.
401-
<start_line_number> must belong to the same hunk as the
402-
<end_line_number>.
403-
- Do not repeat back the code being reviewed as the the line number range is
404-
sufficient to map your comment to the correct location in GitHub.
405-
- Markdown format is preferred for review comment text.
406-
- Fenced code blocks must be used for new content and replacement
407-
code/text snippets.
408-
- Replacement code/text snippets must be complete and correctly
409-
formatted. The line number range must map exactly to the line
410-
number range that need to be replaced within a new_hunk_for_review.
411-
E.g. if you are suggesting to replace 2 specific lines in a
412-
new_hunk_for_review with 10 lines of code, then the line number
413-
range must be exactly the 2 lines that need to be replaced.
414-
The replacement code/text snippet must use \`suggestion\` as the
415-
language identifier in the fenced code block. Replacement code
416-
suggestions can be directly committed by the user from the GitHub
417-
UI, replacing the code within new_hunk_for_review, that is why
418-
alignment of line number ranges is important.
419-
- New code/text snippets must use the correct language identifier
420-
in the fenced code block. You can use such snippets to suggest
421-
code that can be added in some other file, e.g. test cases.
422-
- Do not annotate snippets with line numbers inside the code blocks.
423-
- If there are no issues or suggestions and the hunk is acceptable as-is,
424-
your comment on the line ranges must include the word 'LGTM!'.
425-
- Reflect on the provided code and your review comments at least 3 times
426-
before sending the final response. Double check the line number ranges
427-
and the content of the review sections.
428-
429-
Response format expected -
394+
- Respond using the specified format, which includes a line number range and
395+
a review comment for each section.
396+
- Line number ranges must be within the same new hunk.
397+
- Do not repeat the code being reviewed, as line number ranges are sufficient
398+
for locating comments.
399+
- Consider the context provided by the old hunk and comment chain when
400+
reviewing the new hunk.
401+
- Use Markdown format for review comments to improve readability.
402+
- If needed, provide a replacement suggestion using the exact line number
403+
range and fenced code blocks with the suggestion language identifier.
404+
These can be directly committed by the user in the GitHub UI. Replacement
405+
code/text snippets must be complete and correctly formatted.
406+
- If needed, suggest new code using the correct language identifier in fenced
407+
code blocks. These snippets may be added to a different file, such as test cases.
408+
- Do not annotate code snippets with line numbers inside the code blocks.
409+
- If there are no issues with a hunk, comment "LGTM!" for the respective line range.
410+
- Review your comments and line number ranges at least 3 times before sending
411+
the final response to ensure accuracy.
412+
413+
Response format expected:
430414
<start_line_number>-<end_line_number>:
431415
<review comment>
432416
---
@@ -444,20 +428,29 @@ Response format expected -
444428
---
445429
...
446430
431+
Example request:
432+
---new_hunk_for_review---
433+
1: def add(x, y):
434+
2: z = x+y
435+
3: retrn z
436+
4:
437+
5: def multiply(x, y):
438+
6: return x * y
439+
440+
---old_hunk_for_context---
441+
def add(x, y):
442+
return x + y
443+
447444
Example response:
448-
1-5:
449-
LGTM!
450-
---
451-
6-6:
452-
replace the code on line 6 with the following
445+
3-3:
446+
There's a typo in the return statement.
453447
\`\`\`suggestion
454-
for i in range(10):
455-
print("Hello!")
456-
print("World!")
457-
exit(0)
448+
return z
458449
\`\`\`
459450
---
460-
451+
5-6:
452+
LGTM!
453+
---
461454
462455
Hunks for review are below:
463456
`

0 commit comments

Comments
 (0)