Skip to content
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

[refactor] cleanup warnings #984

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[refactor] cleanup warnings #984

wants to merge 2 commits into from

Conversation

gregnazario
Copy link
Contributor

Description

Cleans up some more warnings for lints

Related Links

Checklist

`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(
functionName,
)}\\s*(?:<|\\()`,
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence '\s' is equivalent to just 's', so the sequence is not a character class when it is used in a
regular expression
.

Copilot Autofix AI 15 days ago

To fix the problem, we need to ensure that the escape sequence \s is correctly interpreted as a whitespace character in the regular expression. This can be achieved by adding an extra backslash to escape the backslash itself in the string literal. This way, the regular expression will correctly interpret \\s as \s.

  • Update the regular expression pattern on line 137 to use double backslashes for the \s escape sequence.
  • No additional methods, imports, or definitions are needed to implement this change.
Suggested changeset 1
src/utils.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/src/utils.ts b/src/utils.ts
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -136,3 +136,3 @@
   const publicEntryFunRegexp = new RegExp(
-    `\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
+    `\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
   );
EOF
@@ -136,3 +136,3 @@
const publicEntryFunRegexp = new RegExp(
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(
functionName,
)}\\s*(?:<|\\()`,
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence '\s' is equivalent to just 's', so the sequence is not a character class when it is used in a
regular expression
.

Copilot Autofix AI 15 days ago

To fix the problem, we need to ensure that the escape sequence \s is correctly interpreted as a whitespace character in the regular expression. This can be achieved by adding an extra backslash to escape the backslash itself in the string literal. This way, the regular expression will correctly interpret \\s as \s.

  • Update the regular expression pattern on line 137 to use double backslashes for the \s escape sequence.
  • No additional methods, imports, or definitions are needed to implement this change.
Suggested changeset 1
src/utils.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/src/utils.ts b/src/utils.ts
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -136,3 +136,3 @@
   const publicEntryFunRegexp = new RegExp(
-    `\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
+    `\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
   );
EOF
@@ -136,3 +136,3 @@
const publicEntryFunRegexp = new RegExp(
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(
functionName,
)}\\s*(?:<|\\()`,
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence '\s' is equivalent to just 's', so the sequence is not a character class when it is used in a
regular expression
.

Copilot Autofix AI 15 days ago

To fix the problem, we need to ensure that the escape sequence \s is correctly interpreted as a whitespace character in the regular expression. This can be achieved by using double backslashes \\s in the string literal, which will be correctly interpreted as \s in the resulting regular expression.

  • Change the escape sequence \s to \\s in the string literal used to create the regular expression.
  • This change should be made on line 137 in the file src/utils.ts.
Suggested changeset 1
src/utils.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/src/utils.ts b/src/utils.ts
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -136,3 +136,3 @@
   const publicEntryFunRegexp = new RegExp(
-    `\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
+    `\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
   );
EOF
@@ -136,3 +136,3 @@
const publicEntryFunRegexp = new RegExp(
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(
functionName,
)}\\s*(?:<|\\()`,
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence '\s' is equivalent to just 's', so the sequence is not a character class when it is used in a
regular expression
.

Copilot Autofix AI 15 days ago

To fix the problem, we need to ensure that the escape sequence \s is correctly interpreted as a whitespace character in the regular expression. This can be achieved by adding an extra backslash to escape the backslash itself in the string literal. This way, the regular expression will correctly interpret \\s as \s.

  • Update the regular expression pattern on line 137 to use double backslashes for the \s escape sequence.
  • No additional methods, imports, or definitions are needed to implement this change.
Suggested changeset 1
src/utils.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/src/utils.ts b/src/utils.ts
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -136,3 +136,3 @@
   const publicEntryFunRegexp = new RegExp(
-    `\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
+    `\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
   );
EOF
@@ -136,3 +136,3 @@
const publicEntryFunRegexp = new RegExp(
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(
functionName,
)}\\s*(?:<|\\()`,
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence '\s' is equivalent to just 's', so the sequence is not a character class when it is used in a
regular expression
.
This autofix suggestion was applied.
Show autofix suggestion Hide autofix suggestion

Copilot Autofix AI 14 days ago

To fix the problem, we need to ensure that the \s escape sequence is correctly interpreted as a whitespace character in the regular expression. This can be achieved by adding an extra backslash to escape the backslash itself in the string literal. This way, the regular expression will correctly interpret \\s as \s.

  • Change the string literal to use double backslashes for the \s escape sequence.
  • Specifically, update line 137 in the file src/utils.ts to use \\s instead of \s.
Suggested changeset 1
src/utils.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/src/utils.ts b/src/utils.ts
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -136,3 +136,3 @@
   const publicEntryFunRegexp = new RegExp(
-    `\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
+    `\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
   );
EOF
@@ -136,3 +136,3 @@
const publicEntryFunRegexp = new RegExp(
`\s*public\s*(entry\s*)?fun\s*${escapeRegExp(functionName)}\s*[<(]`,
`\\s*public\\s*(entry\\s*)?fun\\s*${escapeRegExp(functionName)}\\s*[<(]`,
);
Copilot is powered by AI and may make mistakes. Always verify output.
@gregnazario gregnazario committed this autofix suggestion 14 days ago.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link

netlify bot commented Jan 13, 2025

Deploy Preview for aptos-explorer ready!

Name Link
🔨 Latest commit 5e796d5
🔍 Latest deploy log https://app.netlify.com/sites/aptos-explorer/deploys/678824744273a30008c01e94
😎 Deploy Preview https://deploy-preview-984--aptos-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant