Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add tests for check markdown script #3378
feat: add tests for check markdown script #3378
Changes from 10 commits
5a90f49
5373c9f
a30cef3
a9da240
1079101
86201ed
7c44f4a
c98ecdd
6e34205
4445ce5
333e0b2
8849351
1fbac7c
fada5ab
68cd3ee
998af5a
f5c8964
d92b519
d0fe33a
216a511
8a5235b
a93b45d
2732f0f
4fcdea8
e1a16c1
7401e7f
0fbdc06
02e221b
b17b83e
35d2e84
7921604
9d75691
b36972d
dff6ccc
53c86fd
92cc885
871e305
c0afa97
10c1ba5
2fa09e6
aa0e241
746dc88
4558748
29cd78c
e50392c
7a4b871
d993379
8d9221b
f595339
1cb57f0
4ee6c48
04127eb
bcaf621
dd802c4
1a46eda
3a9916c
cc23800
486b4af
0a91465
17dab5c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 110 in scripts/markdown/check-markdown.js
Codecov / codecov/patch
scripts/markdown/check-markdown.js#L110
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance error handling and optimize async operations.
Several improvements could be made to this function:
await
operations inside the loop could impact performanceConsider these improvements:
📝 Committable suggestion
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 110-110: scripts/markdown/check-markdown.js#L110
Added line #L110 was not covered by tests
🪛 eslint
[error] 102-102: Delete
··
(prettier/prettier)
[error] 103-103: Replace
········
with····
(prettier/prettier)
[error] 104-104: Delete
····
(prettier/prettier)
[error] 104-129: iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.
(no-restricted-syntax)
[error] 105-105: Replace
············
with······
(prettier/prettier)
[error] 106-106: Delete
······
(prettier/prettier)
[error] 108-108: Replace
············
with······
(prettier/prettier)
[error] 109-109: Delete
······
(prettier/prettier)
[error] 110-110: Replace
················
with········
(prettier/prettier)
[error] 110-110: Unexpected use of continue statement.
(no-continue)
[error] 111-111: Delete
······
(prettier/prettier)
[error] 113-113: Replace
············
with······
(prettier/prettier)
[error] 113-113: Unexpected
await
inside a loop.(no-await-in-loop)
[error] 115-115: Delete
······
(prettier/prettier)
[error] 116-116: Replace
············
with······
(prettier/prettier)
[error] 117-117: Delete
········
(prettier/prettier)
[error] 117-117: Unexpected
await
inside a loop.(no-await-in-loop)
[error] 118-118: Replace
············
with······
(prettier/prettier)
[error] 119-119: Replace
················
with········
(prettier/prettier)
[error] 119-119: Unexpected
await
inside a loop.(no-await-in-loop)
[error] 120-120: Delete
········
(prettier/prettier)
[error] 122-122: Replace
················
with········
(prettier/prettier)
[error] 123-123: Replace
················
with········
(prettier/prettier)
[error] 124-124: Delete
··········
(prettier/prettier)
[error] 125-125: Replace
····················errors.forEach(error
with··········errors.forEach((error)
(prettier/prettier)
[error] 126-126: Replace
····················
with··········
(prettier/prettier)
[error] 127-127: Replace
················
with········
(prettier/prettier)
[error] 128-128: Replace
············
with······
(prettier/prettier)
[error] 129-129: Replace
········
with····
(prettier/prettier)
[error] 130-130: Delete
··
(prettier/prettier)
[error] 131-131: Delete
····
(prettier/prettier)
[error] 132-132: Delete
··
(prettier/prettier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vishvamsinh28 Can you apply this suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akshatnema Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling for main script execution
While the
checkMarkdownFiles
function has proper error handling, the main script execution doesn't handle potential errors.Consider wrapping the main execution in an async function with error handling:
📝 Committable suggestion
🧰 Tools
🪛 eslint (1.23.1)
[error] 149-149: Insert
;
(prettier/prettier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vishvamsinh28 Apply this suggestion as it will improve the performance of the script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix variable shadowing of mockConsoleError.
The
mockConsoleError
variable is already declared in the outer scope (line 12) but is redeclared in the test case (line 77). This could lead to confusion and potential issues.Apply this fix:
Also applies to: 75-82
🧰 Tools
🪛 eslint
[error] 11-11: Delete
··
(prettier/prettier)
[error] 12-12: Delete
··
(prettier/prettier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance test assertions for multiple validation errors.
The test only checks the number of errors but not their specific content. This could allow incorrect error messages to pass the test.
🧰 Tools
🪛 eslint
[error] 62-62: Delete
··
(prettier/prettier)
[error] 63-63: Delete
····
(prettier/prettier)
[error] 64-64: Delete
······
(prettier/prettier)
[error] 65-65: Replace
············
with······
(prettier/prettier)
[error] 66-66: Delete
······
(prettier/prettier)
[error] 67-67: Replace
············
with······
(prettier/prettier)
[error] 68-68: Replace
············
with······
(prettier/prettier)
[error] 69-69: Delete
······
(prettier/prettier)
[error] 70-70: Delete
····
(prettier/prettier)
[error] 71-71: Delete
····
(prettier/prettier)
[error] 73-73: Delete
····
(prettier/prettier)
[error] 74-74: Delete
··
(prettier/prettier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vishvamsinh28, thank you for making the changes!
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!