Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

test: wrong indent #7

Closed
wants to merge 2 commits into from
Closed

test: wrong indent #7

wants to merge 2 commits into from

Conversation

kxxt
Copy link
Owner

@kxxt kxxt commented Dec 7, 2022

Let chatgpt comment on this PR.

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

There are several problems with the patch in the code block. First, there are unnecessary indentations in the code, which can make the code difficult to read and maintain. Second, there is an extra space before the repo variable on lines 8 and 11, which could cause errors. Finally, the patch does not include a description of what changes it is making, which makes it difficult to understand the purpose of the patch.

To fix these problems, the patch should be reformatted to use consistent indentation, remove the extra spaces before the repo variable, and include a description of the changes being made. For example:

From 26bdf249f5491972eb0eb118954c274b06dd58fe Mon Sep 17 00:00:00 2001
From: kxxt <rsworktech@outlook.com>
Date: Wed, 7 Dec 2022 20:16:52 +0800
Subject: [PATCH] Fix indentation and remove extra spaces in index.js

---
 index.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 50429c1..7de5b9d 100644
--- a/index.js
+++ b/index.js
@@ -66,17 +66,19 @@ async function run() {
     } else if (mode == "review") {
       const { data: diff } = await octokit.rest.pulls.get({
         owner,
-        repo,
+        repo,
+
         pull_number: number,
-        mediaType: {
-          format: "patch",
+        mediaType: {
+          format: "patch",
         },
       });
       core.info(diff);
       const response = await callChatGPT(api, genReviewPRPrompt(diff));
-      await octokit.issues.createComment({
+        await octokit.issues.createComment({
         ...context.repo,
-        issue_number: number,
+        issue_number: number,
         body: response,
       });
     }

This patch should fix the problems with the original patch and make the code easier to read and understand.

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

This patch appears to contain some problems. In the first patch, there are some inconsistent indentation and whitespace errors. In the second patch, there is a syntax error (a semicolon instead of a comma in the object literal on line 21). Additionally, the second patch appears to remove some code that was added in the first patch.

To fix these issues, the indentation and whitespace should be standardized and the syntax error should be fixed. The code that was removed in the second patch should also be restored. Here is how the first patch could be fixed:

From 26bdf249f5491972eb0eb118954c274b06dd58fe Mon Sep 17 00:00:00 2001
From: kxxt <rsworktech@outlook.com>
Date: Wed, 7 Dec 2022 20:16:52 +0800
Subject: [PATCH 1/2] wrong indent

---
 index.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 50429c1..7de5b9d 100644
--- a/index.js
+++ b/index.js
@@ -66,17 +66,19 @@ async function run() {
     } else if (mode == "review") {
       const { data: diff } = await octokit.rest.pulls.get({
         owner,
         repo,
         pull_number: number,
         mediaType: {
           format: "patch",
         },
       });
       core.info(diff);
       const response = await callChatGPT(api, genReviewPRPrompt(diff));
       await octokit.issues.createComment({
         ...context.repo,
         issue_number: number,
         body: response,
       });
     }

And here is how the second patch could be fixed:

From 544fb3359f40736f53faad103cb9a4ac60c6c540 Mon Sep 17 00:00:00 2001
From: kxxt <rsworktech@outlook.com>
Date: Wed, 7 Dec 2022 20:24:59 +0800
Subject: [PATCH 2/2] make it wrong

---
 index.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/index.js b/index.js
index 7de5b9d..0cdaf0b 100644
--- a/index.js
+++ b/index.js
@@ -29,7 +29,7 @@ changes: `;
 }
 
 function genReviewPRPrompt(diff) {
-  return `Can you tell me the problems with the following patch and your suggestions?\n${diff}`;
+  return `Can you tell me the problems with the following patch and your suggestions?\n${diff}`;
 }
 
 // most @actions toolkit packages have async methods
@@ -66,17 +66,19 @@ async function run() {
     } else if (mode == "review") {
       const { data: diff } = await octokit.rest.pulls.get({
         owner,
         repo,
         pull_number: number,
         mediaType: {
           format: "

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant