-
Notifications
You must be signed in to change notification settings - Fork 0
Add check to start server if module is main #30
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,3 +14,6 @@ | |||||||
| } | ||||||||
|
|
||||||||
|
|
||||||||
| if (typeof require !== 'undefined' && typeof module !== 'undefined' && require.main === module) { | ||||||||
|
Check warning on line 17 in index.ts
|
||||||||
| startServer(DEFAULT_PORT); | ||||||||
| } | ||||||||
|
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove duplicated main-module startup block. Line 17 duplicates the existing startup guard (Lines 12-14), so Proposed fix-if (typeof require !== 'undefined' && typeof module !== 'undefined' && require.main === module) {
- startServer(DEFAULT_PORT);
-}📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: SonarCloud Code Analysis[warning] 17-17: Compare with [warning] 17-17: Compare with 🤖 Prompt for AI Agents |
||||||||
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.
Duplicate if-block calling startServer(DEFAULT_PORT) was added; remove the redundant block so server-start logic exists only once.
Show fix
Details
✨ AI Reasoning
The change added a second, identical guard that calls startServer(DEFAULT_PORT). This creates two identical if-blocks in the same file that perform the same action when require.main === module. Duplicated runtime-start logic increases maintenance burden and risks inconsistent updates if one copy is changed later. The duplication was introduced by the added lines and is localized to the new block.
Reply
@AikidoSec feedback: [FEEDBACK]to get better review comments in the future.Reply
@AikidoSec ignore: [REASON]to ignore this issue.More info