Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
}


if (typeof require !== 'undefined' && typeof module !== 'undefined' && require.main === module) {

Check warning on line 17 in index.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Compare with `undefined` directly instead of using `typeof`.

See more on https://sonarcloud.io/project/issues?id=dejarno_signature-generator&issues=AZ1xcdzJy10cRilHCVBX&open=AZ1xcdzJy10cRilHCVBX&pullRequest=30

Check warning on line 17 in index.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Compare with `undefined` directly instead of using `typeof`.

See more on https://sonarcloud.io/project/issues?id=dejarno_signature-generator&issues=AZ1xcdzJy10cRilHCVBW&open=AZ1xcdzJy10cRilHCVBW&pullRequest=30
startServer(DEFAULT_PORT);
}
Comment on lines 15 to +19

Copy link
Copy Markdown

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
Suggested change
if (typeof require !== 'undefined' && typeof module !== 'undefined' && require.main === module) {
startServer(DEFAULT_PORT);
}
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

Comment on lines +17 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove duplicated main-module startup block.

Line 17 duplicates the existing startup guard (Lines 12-14), so startServer(DEFAULT_PORT) executes twice when run as the main module. Since startServer binds the port immediately, the second call can trigger EADDRINUSE and break startup.

Proposed fix
-if (typeof require !== 'undefined' && typeof module !== 'undefined' && require.main === module) {
-  startServer(DEFAULT_PORT);
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (typeof require !== 'undefined' && typeof module !== 'undefined' && require.main === module) {
startServer(DEFAULT_PORT);
}
🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis

[warning] 17-17: Compare with undefined directly instead of using typeof.

See more on https://sonarcloud.io/project/issues?id=dejarno_signature-generator&issues=AZ1xcdzJy10cRilHCVBX&open=AZ1xcdzJy10cRilHCVBX&pullRequest=30


[warning] 17-17: Compare with undefined directly instead of using typeof.

See more on https://sonarcloud.io/project/issues?id=dejarno_signature-generator&issues=AZ1xcdzJy10cRilHCVBW&open=AZ1xcdzJy10cRilHCVBW&pullRequest=30

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@index.ts` around lines 17 - 19, The duplicate main-module startup guard
should be removed to prevent startServer(DEFAULT_PORT) being called twice;
locate the repeated require.main === module check block that calls
startServer(DEFAULT_PORT) and delete the redundant occurrence so only the
original startup guard (the other require/main check that calls startServer)
remains; ensure startServer, DEFAULT_PORT and the remaining require.main ===
module guard are left intact.

Loading