Copilot commented on code in PR #318:
URL: https://github.com/apache/ozone-site/pull/318#discussion_r2825382120


##########
package.json:
##########
@@ -12,7 +12,9 @@
     "clear": "docusaurus clear",
     "serve": "docusaurus serve --port 3001",
     "write-translations": "docusaurus write-translations",
-    "write-heading-ids": "docusaurus write-heading-ids"
+    "write-heading-ids": "docusaurus write-heading-ids",
+    "lint": "markdownlint . && yamllint --format=colored \"$(git rev-parse 
--show-toplevel)\"",
+    "lint:fix": " markdownlint --fix . && yamllint --format=colored \"$(git 
rev-parse --show-toplevel)\""

Review Comment:
   Extra leading space in the lint:fix script value. The value should start 
with "markdownlint" not " markdownlint".
   ```suggestion
       "lint:fix": "markdownlint --fix . && yamllint --format=colored \"$(git 
rev-parse --show-toplevel)\""
   ```



##########
package.json:
##########
@@ -12,7 +12,9 @@
     "clear": "docusaurus clear",
     "serve": "docusaurus serve --port 3001",
     "write-translations": "docusaurus write-translations",
-    "write-heading-ids": "docusaurus write-heading-ids"
+    "write-heading-ids": "docusaurus write-heading-ids",
+    "lint": "markdownlint . && yamllint --format=colored \"$(git rev-parse 
--show-toplevel)\"",
+    "lint:fix": " markdownlint --fix . && yamllint --format=colored \"$(git 
rev-parse --show-toplevel)\""

Review Comment:
   The yamllint command is used in both lint scripts but yamllint is not listed 
as a dependency in package.json. While yamllint is pre-installed on GitHub 
Actions runners, developers running these commands locally will need to install 
yamllint separately via pip or their package manager. Consider adding a note in 
the CONTRIBUTING.md file about this prerequisite, or explore using a 
Node.js-based YAML linter that can be added as a devDependency.



##########
docusaurus.config.js:
##########
@@ -157,7 +161,8 @@ const config = {
             const {defaultCreateSitemapItems, ...rest} = params;
             const items = await defaultCreateSitemapItems(rest);
 
-            const validUrlRegex = 
/^https:\/\/ozone\.apache\.org\/([a-z0-9][a-z0-9./-]*[a-z0-9/])?$/;
+            // TODO Base URL must be updated when the new website's branch is 
merged.
+            const validUrlRegex = new 
RegExp('^https://ozone-site-v2\.staged\.apache\.org/([a-z0-9][a-z0-9\./-]*[a-z0-9/])?$');

Review Comment:
   The regex pattern uses single backslashes in the RegExp constructor string. 
In JavaScript, when passing a string to the RegExp constructor, backslashes 
need to be doubled to properly escape special regex characters. The dots should 
be escaped as `\\.` instead of `\.`, and the forward slashes as `\\/` instead 
of `\/`. The current pattern will match any character instead of literal dots 
and forward slashes. The correct pattern should be: `new 
RegExp('^https://ozone-site-v2\\.staged\\.apache\\.org/([a-z0-9][a-z0-9\\./-]*[a-z0-9/])?$')`
   ```suggestion
               const validUrlRegex = new 
RegExp('^https://ozone-site-v2\\.staged\\.apache\\.org/([a-z0-9][a-z0-9\\./-]*[a-z0-9/])?$');
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to