Added debugging information for comments that are excluded from PRs actual code

This commit is contained in:
Jimmy Royer 2024-09-17 14:55:59 -04:00
parent 6791d85b9d
commit 8ded98d88f
3 changed files with 17 additions and 1 deletions

8
dist/index.js vendored
View file

@ -221,6 +221,14 @@ require("./sourcemap-register.js");
const validAIResponses = aiResponse.filter((response) => const validAIResponses = aiResponse.filter((response) =>
validLineNumbers.has(Number(response.lineNumber)) validLineNumbers.has(Number(response.lineNumber))
); );
// Leave a log for each invalid line numbers for further debugging.
aiResponse.forEach((response) => {
if (!validLineNumbers.has(Number(response.lineNumber))) {
console.log(
`Invalid line number: ${response.lineNumber} in file: ${file.to}\nComment: ${response.reviewComment}`
);
}
});
const newComments = createComment( const newComments = createComment(
file, file,
chunk, chunk,

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -128,6 +128,14 @@ async function analyzeCode(
const validAIResponses = aiResponse.filter((response) => const validAIResponses = aiResponse.filter((response) =>
validLineNumbers.has(Number(response.lineNumber)) validLineNumbers.has(Number(response.lineNumber))
); );
// Leave a log for each invalid line numbers for further debugging.
aiResponse.forEach((response) => {
if (!validLineNumbers.has(Number(response.lineNumber))) {
console.log(
`Invalid line number: ${response.lineNumber} in file: ${file.to}\nComment: ${response.reviewComment}`
);
}
});
const newComments = createComment(file, chunk, validAIResponses); const newComments = createComment(file, chunk, validAIResponses);
if (newComments) { if (newComments) {
comments.push(...newComments); comments.push(...newComments);