-
Notifications
You must be signed in to change notification settings - Fork 0
Json #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| { | ||
| "name": "open-ai-reviewer", | ||
| "name": "roast-my-code", | ||
| "version": "1.0.0", | ||
| "description": "Open AI powered code reviews", | ||
| "description": "mean and aggressive code reviews by ChatGPT", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description should be more professional and less aggressive. Consider rephrasing to maintain a suitable tone for a public package. |
||
| "main": "lib/main.js", | ||
| "author": "Ville Saukkonen", | ||
| "author": "Christina Martinez, based on work by Ville Saukkonen", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Attribution should be clear and concise. If the work is based on Ville Saukkonen's contributions, consider simplifying the author field to avoid confusion. |
||
| "license": "MIT", | ||
| "scripts": { | ||
| "build": "tsc", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,16 +164,33 @@ function createComment( | |
| reviewComment: string; | ||
| }> | ||
| ): Array<{ body: string; path: string; line: number }> { | ||
| return aiResponses.flatMap((aiResponse) => { | ||
| const comments = aiResponses.flatMap((aiResponse) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
| if (!file.to) { | ||
| return []; | ||
| } | ||
| return { | ||
| body: aiResponse.reviewComment, | ||
| path: file.to, | ||
| line: Number(aiResponse.lineNumber), | ||
| }; | ||
| // Log the AI response and the file path | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The commented-out code should be removed to maintain clean code practices. |
||
| console.log("AI Response:", aiResponse); | ||
| console.log("File Path:", file.to); | ||
| console.log("Chunk:", chunk); | ||
|
|
||
| const lineNumber = Number(aiResponse.lineNumber); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
|
|
||
| // Ensure the line number exists in the chunk | ||
| if (chunk.changes.some((change: { ln: number; ln2: number; }) => change.ln === lineNumber || change.ln2 === lineNumber)) { | ||
| return { | ||
| body: aiResponse.reviewComment, | ||
| path: file.to, | ||
| line: lineNumber, | ||
| }; | ||
| } else { | ||
| console.warn(`Line number ${lineNumber} does not exist in the diff for file ${file.to}`); | ||
| return []; | ||
| } | ||
| }); | ||
|
|
||
| // Log the comments before returning | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The log statement for comments may expose sensitive information in production. Consider removing or guarding it with a debug flag. |
||
| console.log("Comments:", comments); | ||
| return comments; | ||
| } | ||
|
|
||
| async function createReviewComment( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name change from "open-ai-reviewer" to "roast-my-code" may not accurately reflect the purpose of the package. Consider a name that better represents the functionality.