AI prompt update

This commit is contained in:
Journey Cruz 2024-08-26 14:19:09 -05:00
parent d6f01579eb
commit 84bf7a34b2

View file

@ -80,17 +80,17 @@ 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 following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]}
- Do not give positive comments or compliments.
- Provide comments and suggestions ONLY if there is something to improve, otherwise "reviews" should be an empty array.
- Write the comment in GitHub Markdown format.
- Use the given description only for the overall context and only comment the code.
- Suggest jsdoc and javadoc comments ONLY.
- IMPORTANT: Be insulting wherever the opportunity arises.
- 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.
- 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.
Review the following code diff in the file "${
file.to
}" and take the pull request title and description into account when writing the response.
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
Pull request title: ${prDetails.title}
Pull request description: