Skip to content

Commit

Permalink
collapse skipped files lists (coderabbitai#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
harjotgill authored Mar 27, 2023
1 parent 1e1beaf commit 8c16510
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 49 deletions.
54 changes: 36 additions & 18 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 44 additions & 31 deletions src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,32 +225,42 @@ ${filename}: ${summary}

const summarize_comment = `${summarize_final_response}
${
filter_ignored_files.length > 0
? `
---
### Files ignored due to filter (${filter_ignored_files.length})
- ${filter_ignored_files.map(file => file.filename).join('\n- ')}
### Chat with 🤖 OpenAI Bot (\`@openai\`)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging \`@openai\` in a reply.
---
${filter_ignored_files.length > 0
? `
<details>
<summary>Files ignored due to filter (${filter_ignored_files.length})</summary>
### Ignored files
* ${filter_ignored_files.map(file => file.filename).join('\n* ')}
</details>
`
: ''
}
: ''
}
${
skipped_files_to_summarize.length > 0
? `
### Files not summarized due to max files limit (${
skipped_files_to_summarize.length
})
- ${skipped_files_to_summarize.join('\n - ')}`
: ''
}
${skipped_files_to_summarize.length > 0
? `
<details>
<summary>Files not summarized due to max files limit (${skipped_files_to_summarize.length
})</summary>
---
### Not summarized
### Chat with 🤖 OpenAI Bot (\`@openai\`)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging \`@openai\` in a reply.
* ${skipped_files_to_summarize.join('\n* ')}
</details>
`
: ''
}
`

next_summarize_ids = summarize_final_response_ids
Expand Down Expand Up @@ -445,22 +455,25 @@ ${

// comment about skipped files for review and summarize
if (skipped_files_to_review.length > 0) {
const tag = '<!-- openai-skipped-files -->'
// make bullet points for skipped files
const comment = `
${tag}
${skipped_files_to_review.length > 0
? `<details>
<summary>Files not reviewed due to max files limit (${skipped_files_to_review.length
})</summary>
${
skipped_files_to_review.length > 0
? `
### Files not reviewed due to max files limit (${
skipped_files_to_review.length
})
- ${skipped_files_to_review.join('\n - ')}`
### Not reviewed
* ${skipped_files_to_review.join('\n* ')}
</details>
`
: ''
}
}
`
await commenter.comment(comment, tag, 'replace')
if (comment.length > 0) {
await commenter.comment(comment, SUMMARIZE_TAG, 'append')
}
}
}
}
Expand Down

0 comments on commit 8c16510

Please sign in to comment.