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: code style format to phcode eslint style #1861

Merged
merged 1 commit into from
Sep 19, 2024
Merged

refactor: code style format to phcode eslint style #1861

merged 1 commit into from
Sep 19, 2024

Conversation

abose
Copy link
Member

@abose abose commented Sep 19, 2024

No description provided.

@abose abose changed the title refactor: code style formattic to phcode eslint style refactor: code style format to phcode eslint style Sep 19, 2024
@abose abose merged commit e74ef8c into main Sep 19, 2024
13 of 15 checks passed
@abose abose deleted the bp branch September 19, 2024 02:57
Copy link

sonarcloud bot commented Sep 19, 2024

// Run jsdoc-to-mdx
execSync(`npx jsdoc-to-mdx -c ${path.relative(__dirname, configFile)}`, { cwd: __dirname });
// Run jsdoc-to-mdx
execSync(`npx jsdoc-to-mdx -c ${path.relative(__dirname, configFile)}`, { cwd: __dirname });

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.
This shell command depends on an uncontrolled
absolute path
.
let content = fs.readFileSync(filePath, 'utf-8');

// Escape curly braces
content = content.replace(/\{/g, '\\{');

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix AI 1 day ago

To fix the problem, we need to ensure that backslashes are properly escaped in addition to curly braces. This can be achieved by adding a replace operation for backslashes before the existing replace operation for curly braces. We will use a regular expression with the global flag to ensure all occurrences are replaced.

build/api-docs-generator.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/build/api-docs-generator.js b/build/api-docs-generator.js
--- a/build/api-docs-generator.js
+++ b/build/api-docs-generator.js
@@ -400,4 +400,4 @@
 
-    // Escape curly braces
-    content = content.replace(/\{/g, '\\{');
+    // Escape backslashes and curly braces
+    content = content.replace(/\\/g, '\\\\').replace(/\{/g, '\\{');
 
EOF
@@ -400,4 +400,4 @@

// Escape curly braces
content = content.replace(/\{/g, '\\{');
// Escape backslashes and curly braces
content = content.replace(/\\/g, '\\\\').replace(/\{/g, '\\{');

Copilot is powered by AI and may make mistakes. Always verify output.
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