Skip to content

chore: fix inconsistent function name in comment#6338

Merged
dogancanbakir merged 1 commit intoprojectdiscovery:devfrom
jishudashen:dev
Jul 21, 2025
Merged

chore: fix inconsistent function name in comment#6338
dogancanbakir merged 1 commit intoprojectdiscovery:devfrom
jishudashen:dev

Conversation

@jishudashen
Copy link
Contributor

@jishudashen jishudashen commented Jul 21, 2025

Proposed changes

fix inconsistent function name in comment

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Documentation
    • Improved and corrected comments for several methods to enhance clarity and consistency in the documentation. No changes to application functionality.

Signed-off-by: jishudashen <jishudashen@foxmail.com>
@auto-assign auto-assign bot requested a review from dogancanbakir July 21, 2025 06:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Walkthrough

This update makes minor corrections to comments in three files, aligning function and method names in the comments with their actual code declarations. No logic, implementation, or interface changes are present.

Changes

File(s) Change Summary
pkg/protocols/protocols.go Updated comment to match method name (GetThreadsForNPayloadRequests).
pkg/protocols/utils/http/requtils.go Capitalized comment for SetHeader function.
pkg/templates/signer/handler.go Corrected method comment from ReadUserCert to ReadCert.

Estimated code review effort

1 (<30 minutes)

Possibly related PRs

Suggested reviewers

  • dogancanbakir

Poem

A bunny with a pen, so neat,
Fixes comments for a tidy feat.
No code was harmed, no logic changed,
Just words and names re-arranged.
With every hop and gentle nudge,
The codebase shines—oh, what a judge!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
pkg/protocols/protocols.go (1)

160-168: totalRequests is unused – the code will not compile.

Go rejects unused parameters; this slipped CI because the build must already be broken or the file is excluded. Either utilise the argument or rename it to _.

Quick, minimal fix:

-func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests int, currentThreads int) int {
+func (e *ExecutorOptions) GetThreadsForNPayloadRequests(_ int, currentThreads int) int {

Preferably, incorporate the value to avoid oversubscription:

func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests, currentThreads int) int {
	if currentThreads > 0 {
		return currentThreads
	}
	if totalRequests > 0 && totalRequests < e.Options.PayloadConcurrency {
		return totalRequests
	}
	return e.Options.PayloadConcurrency
}
🧹 Nitpick comments (2)
pkg/protocols/utils/http/requtils.go (1)

38-46: Header lookup is case-sensitive – consider canonicalising the key.

http.Header normalises keys when they are added, but direct map access (req.Header[name]) is case-sensitive.
A caller passing "content-type" instead of "Content-Type" will bypass this guard and duplicate the header.

-func SetHeader(req *retryablehttp.Request, name, value string) {
-    if _, ok := req.Header[name]; !ok {
-        req.Header.Set(name, value)
+func SetHeader(req *retryablehttp.Request, name, value string) {
+    cName := http.CanonicalHeaderKey(name)
+    if _, ok := req.Header[cName]; !ok {
+        req.Header.Set(cName, value)
     }
-    if name == "Host" {
+    if cName == "Host" {
         req.Host = value
     }
 }
pkg/templates/signer/handler.go (1)

50-62: Surface I/O errors when loading certificate from disk.

If os.ReadFile fails for reasons other than “file not found” (e.g., permission denied, I/O error), the current implementation silently returns ErrNoCertificate, hiding the root cause.

-    if cert, err := os.ReadFile(filepath.Join(dir, CertFilename)); err == nil {
-        k.UserCert = cert
-        return nil
-    }
-    return ErrNoCertificate
+    if cert, err := os.ReadFile(filepath.Join(dir, CertFilename)); err == nil {
+        k.UserCert = cert
+        return nil
+    } else if !errors.Is(err, os.ErrNotExist) {
+        return err
+    }
+    return ErrNoCertificate

(import "errors")

Same pattern applies to ReadPrivateKey.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9133e0d and 0337b33.

📒 Files selected for processing (3)
  • pkg/protocols/protocols.go (1 hunks)
  • pkg/protocols/utils/http/requtils.go (1 hunks)
  • pkg/templates/signer/handler.go (1 hunks)
🔇 Additional comments (2)
pkg/protocols/utils/http/requtils.go (1)

38-38: Comment capitalization fix is correct.
No functional impact – good catch.

pkg/templates/signer/handler.go (1)

49-49: Comment now matches the method – looks good.

@dogancanbakir dogancanbakir merged commit 5daf84d into projectdiscovery:dev Jul 21, 2025
1 check passed
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.

2 participants