Skip to content

Conversation

@lishaduck
Copy link
Member

I'm not going to pretend like I've got lots of time to resume lowlighter#1542, but I'd at least like to make sure it doesn't get lost to the stale bot.

@lishaduck
Copy link
Member Author

Tests are throwing lots of errors, but they pass!?


// Search for specific filename
// deno-lint-ignore no-constant-condition
if (false) {

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to remove the unreachable code block. This involves deleting the if (false) statement and the code inside it. This will clean up the code and remove the unreachable statement.

  • Remove the if (false) statement and its block from lines 43 to 45.
  • Similarly, remove the if (false) statement and its block from lines 49 to 51.
Suggested changeset 1
source/engine/utils/language.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/engine/utils/language.ts b/source/engine/utils/language.ts
--- a/source/engine/utils/language.ts
+++ b/source/engine/utils/language.ts
@@ -41,12 +41,12 @@
   // Search for specific filename
-  // deno-lint-ignore no-constant-condition
-  if (false) {
-    result.from = "filename"
-  }
+
+
+
+
 
   // Search for specific extension
-  // deno-lint-ignore no-constant-condition
-  if (false) {
-    result.from = "extension"
-  }
+
+
+
+
 
EOF
@@ -41,12 +41,12 @@
// Search for specific filename
// deno-lint-ignore no-constant-condition
if (false) {
result.from = "filename"
}





// Search for specific extension
// deno-lint-ignore no-constant-condition
if (false) {
result.from = "extension"
}





Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated

// Search for specific extension
// deno-lint-ignore no-constant-condition
if (false) {

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to remove the unreachable code block. This involves deleting the if (false) statement and the code within its block. This will clean up the code and remove any dead code that serves no purpose.

  • Remove the if (false) statement and its block on lines 48-51.
  • Ensure that the removal does not affect the functionality of the rest of the code.
Suggested changeset 1
source/engine/utils/language.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/engine/utils/language.ts b/source/engine/utils/language.ts
--- a/source/engine/utils/language.ts
+++ b/source/engine/utils/language.ts
@@ -47,6 +47,3 @@
   // Search for specific extension
-  // deno-lint-ignore no-constant-condition
-  if (false) {
-    result.from = "extension"
-  }
+
 
EOF
@@ -47,6 +47,3 @@
// Search for specific extension
// deno-lint-ignore no-constant-condition
if (false) {
result.from = "extension"
}


Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
// Pull request created
case "PullRequestEvent": {
return null
if (!["opened", "edited", "closed", "reopened", "assigned", "unassigned"].includes(payload.action)) {

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to remove the unreachable if statement and the subsequent code that is also unreachable. This will clean up the code and remove any confusion about the intended logic. Specifically, we should remove lines 197-203, as they will never be executed.

Suggested changeset 1
source/plugins/activity/mod.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/plugins/activity/mod.ts b/source/plugins/activity/mod.ts
--- a/source/plugins/activity/mod.ts
+++ b/source/plugins/activity/mod.ts
@@ -196,9 +196,2 @@
                 return null
-                if (!["opened", "edited", "closed", "reopened", "assigned", "unassigned"].includes(payload.action)) {
-                  return null
-                }
-                if (!matchPatterns(users.matching, payload.pull_request.user.login)) {
-                  return null
-                }
-                return Object.assign(event, { type: "pullrequest", action: payload.action, ...this.pullrequest(payload.pull_request) })
               }
EOF
@@ -196,9 +196,2 @@
return null
if (!["opened", "edited", "closed", "reopened", "assigned", "unassigned"].includes(payload.action)) {
return null
}
if (!matchPatterns(users.matching, payload.pull_request.user.login)) {
return null
}
return Object.assign(event, { type: "pullrequest", action: payload.action, ...this.pullrequest(payload.pull_request) })
}
Copilot is powered by AI and may make mistakes. Always verify output.
// Release published
case "ReleaseEvent": {
return null
if (payload.action !== "published") {

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to remove the unreachable return null statement on line 220. This will allow the subsequent if statement and its block to be evaluated and executed as intended. This change will not alter the existing functionality but will ensure that the code logic is correctly implemented.

Suggested changeset 1
source/plugins/activity/mod.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/plugins/activity/mod.ts b/source/plugins/activity/mod.ts
--- a/source/plugins/activity/mod.ts
+++ b/source/plugins/activity/mod.ts
@@ -219,3 +219,2 @@
               case "ReleaseEvent": {
-                return null
                 if (payload.action !== "published") {
EOF
@@ -219,3 +219,2 @@
case "ReleaseEvent": {
return null
if (payload.action !== "published") {
Copilot is powered by AI and may make mistakes. Always verify output.
parsed[key] ??= value
{
const k = yaml({ [key]: null }, { inline: true }).match(kv)?.groups?.key.trim()
const a = typeof value === "undefined" ? `${value}` : yaml({ [key]: value }, { inline: true }).match(kv)?.groups?.value.trim()

Check warning

Code scanning / CodeQL

Implicit operand conversion Warning

This expression will be implicitly converted from undefined to string.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to make the conversion from undefined to a string explicit. This can be done by using a conditional (ternary) operator to check if value is undefined and then explicitly converting it to an empty string or another appropriate default value. This will make the code clearer and prevent any unintended behavior caused by implicit conversions.

Suggested changeset 1
source/run/compat/parse.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/run/compat/parse.ts b/source/run/compat/parse.ts
--- a/source/run/compat/parse.ts
+++ b/source/run/compat/parse.ts
@@ -109,3 +109,3 @@
       const k = yaml({ [key]: null }, { inline: true }).match(kv)?.groups?.key.trim()
-      const a = typeof value === "undefined" ? `${value}` : yaml({ [key]: value }, { inline: true }).match(kv)?.groups?.value.trim()
+      const a = typeof value === "undefined" ? "" : yaml({ [key]: value }, { inline: true }).match(kv)?.groups?.value.trim()
       const b = yaml({ [key]: parsed[key] }, { inline: true }).match(kv)?.groups?.value.trim()
EOF
@@ -109,3 +109,3 @@
const k = yaml({ [key]: null }, { inline: true }).match(kv)?.groups?.key.trim()
const a = typeof value === "undefined" ? `${value}` : yaml({ [key]: value }, { inline: true }).match(kv)?.groups?.value.trim()
const a = typeof value === "undefined" ? "" : yaml({ [key]: value }, { inline: true }).match(kv)?.groups?.value.trim()
const b = yaml({ [key]: parsed[key] }, { inline: true }).match(kv)?.groups?.value.trim()
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@chickenandpork

This comment was marked as off-topic.

@lishaduck
Copy link
Member Author

@lishaduck I appreciate you forking and helping so many others.

Thank you! ❤️

gh-metrics' main branch commit history looks like a continuous stack though -- you might have trouble rolling-back a PR if it breaks things. I would recommend switching to a Squash-commit so that one PR is one committed change; this would also give you the constant history that is required for things like Google Release-Please. Looking forward to being able to make use of your generous work.

I do use squash-commits, but the full CI workflow doesn't run on PRs, so I'm just pushing directly for now.
I'll probably force-push them away once I'm done given there's not much public activity right now (and GitHub will keep them cached so it won't break anyone hash-pinning).
I don't see how that makes a difference for reverts though?

If you want to discuss the setup more, feel free to create a new discussion to keep this PR focused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants