Skip to content

Conversation

@fisehara
Copy link
Contributor

No description provided.

@fisehara fisehara force-pushed the antigravity-fisehara/replace-request branch from 1d2a96a to 667d41e Compare January 22, 2026 12:46
change-type: patch
Signed-off-by: fisehara <harald@balena.io>
@fisehara fisehara force-pushed the antigravity-fisehara/replace-request branch from 667d41e to d636a5b Compare January 22, 2026 15:08
const proxy = new URL(proxyUrl);

// Create the tunnel first using CONNECT
const socket = await new Promise<import('node:net').Socket>(

Choose a reason for hiding this comment

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

Anonymous Promise callback contains multi-step proxy CONNECT logic; extract into a named function to improve readability and testability.

Details

✨ AI Reasoning
​A Promise constructor is created with an anonymous callback that performs multi-step logic: building proxyRequestOptions, handling proxy auth, issuing http.request and wiring 'connect', 'error', and 'timeout' handlers, and resolving/rejecting based on socket events. This is more than a trivial callback and hides business logic inside an unnamed function, making testing and comprehension harder. Extracting this logic into a named function would improve clarity and testability.

🔧 How do I fix it?
Extract complex anonymous functions into named functions with descriptive names, or add explanatory comments for their purpose.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

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