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

Commit e0e844a

Browse files
authored
remove redundant instructions (#168)
1 parent 358f2ef commit e0e844a

File tree

3 files changed

+138
-127
lines changed

3 files changed

+138
-127
lines changed

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ inputs:
103103
- Optimization
104104
105105
In general, refrain from making noisy comments such as on minor
106-
code style issues, compliments, etc. unless explicitly requested and
107-
keep the focus on substantive issues that can improve the quality
108-
of the code.
106+
code style issues, compliments, missing documentation, etc.
107+
unless explicitly requested and keep the focus on substantive issues
108+
that can improve the quality of the code.
109109
summarize_file_diff:
110110
required: false
111111
description: 'The prompt for file'

dist/index.js

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

src/review.ts

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -390,68 +390,6 @@ Format for changes:
390390
---end_change_section---
391391
...
392392
393-
Instructions:
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:
414-
<start_line_number>-<end_line_number>:
415-
<review comment>
416-
---
417-
<start_line_number>-<end_line_number>:
418-
<review comment>
419-
\`\`\`suggestion
420-
<code/text that replaces everything between start_line_number and end_line_number>
421-
\`\`\`
422-
---
423-
<start_line_number>-<end_line_number>:
424-
<review comment>
425-
\`\`\`<language>
426-
<new code snippet>
427-
\`\`\`
428-
---
429-
...
430-
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-
444-
Example response:
445-
3-3:
446-
There's a typo in the return statement.
447-
\`\`\`suggestion
448-
return z
449-
\`\`\`
450-
---
451-
5-6:
452-
LGTM!
453-
---
454-
455393
Hunks for review are below:
456394
`
457395

@@ -543,6 +481,74 @@ ${comment_chain}
543481
---end_change_section---
544482
`
545483
}
484+
485+
// add instructions
486+
ins.patches += `
487+
Instructions for you:
488+
- Respond using the below specified format and nothing else. The format
489+
includes a line number range and a review comment for each section.
490+
- Line number ranges must be within the same new hunk and are sufficient
491+
for mapping comments to code sections in GitHub.
492+
- Consider the context provided by the old hunk and comment chain when
493+
reviewing the new hunk.
494+
- Use Markdown format for review comment text.
495+
- If needed, provide a replacement suggestion using the exact line number
496+
range and fenced code blocks with the suggestion language identifier.
497+
These can be directly committed by the user in the GitHub UI. Replacement
498+
code/text snippets must be complete and correctly formatted. For instance,
499+
if 2 lines of code in a hunk need to be replaced with 15 lines of code,
500+
the line number range must be those exact 2 lines. If an entire hunk need to
501+
be replaced with new code, then the line number range must be the entire hunk.
502+
- If needed, suggest new code using the correct language identifier in fenced
503+
code blocks. These snippets may be added to a different file, such as test cases.
504+
- Do not annotate code snippets with line numbers inside the code blocks.
505+
- In your response, focus only on pointing out substantive issues in the hunks.
506+
- If there are no issues in a hunk, comment "LGTM!" for the respective line range.
507+
- Review your comments and line number ranges at least 3 times before sending
508+
the final response to ensure accuracy.
509+
510+
Response format expected:
511+
<start_line_number>-<end_line_number>:
512+
<review comment>
513+
---
514+
<start_line_number>-<end_line_number>:
515+
<review comment>
516+
\`\`\`suggestion
517+
<code/text that replaces everything between start_line_number and end_line_number>
518+
\`\`\`
519+
---
520+
<start_line_number>-<end_line_number>:
521+
<review comment>
522+
\`\`\`<language>
523+
<new code snippet>
524+
\`\`\`
525+
---
526+
...
527+
528+
Example request:
529+
---new_hunk_for_review---
530+
1: def add(x, y):
531+
2: z = x+y
532+
3: retrn z
533+
4:
534+
5: def multiply(x, y):
535+
6: return x * y
536+
537+
---old_hunk_for_context---
538+
def add(x, y):
539+
return x + y
540+
541+
Example response:
542+
3-3:
543+
There's a typo in the return statement.
544+
\`\`\`suggestion
545+
return z
546+
\`\`\`
547+
---
548+
5-6:
549+
LGTM!
550+
---
551+
`
546552
// perform review
547553
try {
548554
const [response] = await heavyBot.chat(

0 commit comments

Comments
 (0)