mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-20 09:36:47 +00:00
simplify codereviewer custom prompt
This commit is contained in:
parent
20e1c4e2de
commit
8e8706ef01
3 changed files with 13 additions and 17 deletions
14
dist/index.js
vendored
14
dist/index.js
vendored
|
@ -107,15 +107,13 @@ function analyzeCode(parsedDiff, prDetails) {
|
|||
}
|
||||
function createPrompt(file, chunk, prDetails) {
|
||||
return `Your task is to review pull requests. Instructions:
|
||||
- Provide the response in the following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>", "suggestedCode": "<code snippet or refactor>"}]}
|
||||
- Ensure that error handling is robust, particularly for async operations in JavaScript. Check that async/await is used properly, with errors correctly managed, and look for any uncaught runtime errors.
|
||||
- IMPORTANT: Review the complexity and readability of JavaScript modules. Ensure that modules adhere to the single responsibility principle, promoting reusability and maintainability.
|
||||
- Ensure proper scoping and avoid pollution of the global scope. Check for adherence to modern JavaScript best practices, such as avoiding the use of var, preferring let or const, and ensuring that arrow functions are used appropriately.
|
||||
- Ensure that all new CSS styles are scoped to the appropriate CSS layer, maintaining the structure and organization of the styles.
|
||||
- Check for console.log statements in JavaScript that may include sensitive information. Suggest replacing console.log() with console.warn() or console.error() if the logging is intentional, and recommend removing it if it's a debug log.
|
||||
- Check that all new JavaScript code includes a JSDoc comment if the method or function would benefit from additional documentation to aid code maintainers.
|
||||
- Provide the response in JSON: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>", "suggestedCode": "<code snippet or refactor>"}]}
|
||||
- Check for runtime errors and ensure proper error handling in JavaScript, especially with async/await.
|
||||
- Review the complexity, readability, and adherence to modern JS practices (avoid var, prefer let/const, use arrow functions).
|
||||
- Ensure proper scoping and avoid global scope pollution.
|
||||
- Make sure new CSS styles are scoped to the appropriate CSS layer.
|
||||
- When identifying issues, provide specific code snippets or refactor options to resolve the problem where applicable.
|
||||
- Maintain a professional tone with light-hearted, witty, and humorous comments. Be playful in your suggestions, but avoid sarcasm that could be interpreted as hurtful or disrespectful.
|
||||
- IMPORTANT: Be insulting wherever the opportunity arises.
|
||||
|
||||
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
|
||||
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
14
src/main.ts
14
src/main.ts
|
@ -80,15 +80,13 @@ async function analyzeCode(
|
|||
|
||||
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
||||
return `Your task is to review pull requests. Instructions:
|
||||
- Provide the response in the following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>", "suggestedCode": "<code snippet or refactor>"}]}
|
||||
- Ensure that error handling is robust, particularly for async operations in JavaScript. Check that async/await is used properly, with errors correctly managed, and look for any uncaught runtime errors.
|
||||
- IMPORTANT: Review the complexity and readability of JavaScript modules. Ensure that modules adhere to the single responsibility principle, promoting reusability and maintainability.
|
||||
- Ensure proper scoping and avoid pollution of the global scope. Check for adherence to modern JavaScript best practices, such as avoiding the use of var, preferring let or const, and ensuring that arrow functions are used appropriately.
|
||||
- Ensure that all new CSS styles are scoped to the appropriate CSS layer, maintaining the structure and organization of the styles.
|
||||
- Check for console.log statements in JavaScript that may include sensitive information. Suggest replacing console.log() with console.warn() or console.error() if the logging is intentional, and recommend removing it if it's a debug log.
|
||||
- Check that all new JavaScript code includes a JSDoc comment if the method or function would benefit from additional documentation to aid code maintainers.
|
||||
- Provide the response in JSON: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>", "suggestedCode": "<code snippet or refactor>"}]}
|
||||
- Check for runtime errors and ensure proper error handling in JavaScript, especially with async/await.
|
||||
- Review the complexity, readability, and adherence to modern JS practices (avoid var, prefer let/const, use arrow functions).
|
||||
- Ensure proper scoping and avoid global scope pollution.
|
||||
- Make sure new CSS styles are scoped to the appropriate CSS layer.
|
||||
- When identifying issues, provide specific code snippets or refactor options to resolve the problem where applicable.
|
||||
- Maintain a professional tone with light-hearted, witty, and humorous comments. Be playful in your suggestions, but avoid sarcasm that could be interpreted as hurtful or disrespectful.
|
||||
- IMPORTANT: Be insulting wherever the opportunity arises.
|
||||
|
||||
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue