Skip to content

chore: replace unused parameter with blank identifier in receiver definitions (st1006) #1275

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ysmolski
Copy link
Contributor

@ysmolski ysmolski commented Aug 14, 2025

https://staticcheck.dev/docs/checks/#ST1006

Summary by CodeRabbit

  • Refactor
    • Standardized internal method receiver declarations across planning, fetching, variables, and node handling for consistency.
    • Improved code readability and uniformity without altering behavior.
  • Style
    • Minor receiver naming cleanups across multiple components.

Notes

  • No changes to user-facing functionality or APIs.
  • No performance impact.
  • Backwards compatible.

Copy link

coderabbitai bot commented Aug 14, 2025

Walkthrough

Refactors method receiver declarations across several engine packages: replaces blank-identifier receivers with unnamed pointer receivers. Affects plan kinds, fetch kinds, and multiple node types, plus a context variable method. No functional logic, return values, or control flow changed; behavior remains the same.

Changes

Cohort / File(s) Summary of Changes
Plan kinds
v2/pkg/engine/plan/plan.go
Updated receiver form on PlanKind methods for SynchronousResponsePlan and SubscriptionResponsePlan from (_ *Type) to (*Type).
Fetch kinds
v2/pkg/engine/resolve/fetch.go
Updated receiver form on FetchKind methods for SingleFetch, BatchEntityFetch, EntityFetch, ParallelListItemFetch from (_ *Type) to (*Type).
Node receivers (array/object/custom/enum/scalar)
v2/pkg/engine/resolve/node_array.go, v2/pkg/engine/resolve/node_object.go, v2/pkg/engine/resolve/node_custom.go, v2/pkg/engine/resolve/node_enum.go, v2/pkg/engine/resolve/node_scalar.go
Standardized method receivers from (_ *Type) to (*Type) across NodeKind, NodePath, NodeNullable, Copy, Equals for Array, EmptyArray, Object, EmptyObject, CustomNode, Enum, Scalar/String/StaticString/Boolean/Float/Integer/BigInt/Null.
Variables
v2/pkg/engine/resolve/variables.go
Updated receiver form on ContextVariable.GetVariableKind from (_ *ContextVariable) to (*ContextVariable).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yury/eng-7862-engine-fix-st1006-issues

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

@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: 3

🧹 Nitpick comments (1)
v2/pkg/engine/resolve/variables.go (1)

84-86: Optional: apply the same receiver-omission pattern for consistency

For consistency with this change and to avoid unused receiver names elsewhere in the file, consider omitting receiver names on other methods that don’t use them:

  • Line 121: func (o *ObjectVariable) GetVariableKind() VariableKind
  • Line 137: func (h *HeaderVariable) GetVariableKind() VariableKind
  • Line 178: func (h *ResolvableObjectVariable) GetVariableKind() VariableKind

Example:

  • func (*ObjectVariable) GetVariableKind() VariableKind { … }
  • func (*HeaderVariable) GetVariableKind() VariableKind { … }
  • func (*ResolvableObjectVariable) GetVariableKind() VariableKind { … }
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 086793c and 965add8.

📒 Files selected for processing (8)
  • v2/pkg/engine/plan/plan.go (2 hunks)
  • v2/pkg/engine/resolve/fetch.go (4 hunks)
  • v2/pkg/engine/resolve/node_array.go (2 hunks)
  • v2/pkg/engine/resolve/node_custom.go (1 hunks)
  • v2/pkg/engine/resolve/node_enum.go (1 hunks)
  • v2/pkg/engine/resolve/node_object.go (2 hunks)
  • v2/pkg/engine/resolve/node_scalar.go (8 hunks)
  • v2/pkg/engine/resolve/variables.go (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (5)
v2/pkg/engine/resolve/node_custom.go (1)
v2/pkg/engine/resolve/node.go (1)
  • NodeKind (28-28)
v2/pkg/engine/resolve/node_enum.go (1)
v2/pkg/engine/resolve/node.go (1)
  • NodeKind (28-28)
v2/pkg/engine/resolve/node_array.go (1)
v2/pkg/engine/resolve/node.go (3)
  • NodeKind (28-28)
  • Node (20-26)
  • NodeKindEmptyArray (7-7)
v2/pkg/engine/resolve/node_scalar.go (1)
v2/pkg/engine/resolve/node.go (3)
  • NodeKind (28-28)
  • NodeKindNull (8-8)
  • Node (20-26)
v2/pkg/engine/resolve/node_object.go (1)
v2/pkg/engine/resolve/node.go (3)
  • NodeKind (28-28)
  • NodeKindEmptyObject (5-5)
  • Node (20-26)
🔇 Additional comments (9)
v2/pkg/engine/resolve/variables.go (1)

84-86: ST1006 compliance: good move to an unnamed receiver

Omitting the unused receiver name is correct and aligns with Staticcheck ST1006. No behavior change.

v2/pkg/engine/plan/plan.go (2)

28-30: Receiver cleanup aligns with ST1006

Switching from (_ *SynchronousResponsePlan) to (*SynchronousResponsePlan) is correct and keeps the receiver unnamed where unused. No functional impact.


41-43: Receiver cleanup aligns with ST1006

Same here for SubscriptionResponsePlan. Looks good; no behavior change.

v2/pkg/engine/resolve/fetch.go (3)

155-157: Conforms to ST1006: unnamed receiver

Using an unnamed receiver on SingleFetch.FetchKind is correct. No change in behavior.


203-205: Conforms to ST1006: unnamed receiver

BatchEntityFetch.FetchKind updated appropriately. No functional changes.


242-244: Conforms to ST1006: unnamed receiver

EntityFetch.FetchKind updated appropriately. Behavior unchanged.

v2/pkg/engine/resolve/node_enum.go (1)

14-16: ST1006-compliant receiver change

Good switch to an unnamed receiver on Enum.NodeKind. Maintains behavior and improves style.

v2/pkg/engine/resolve/node_custom.go (1)

17-19: ST1006-compliant receiver change

Correctly removes the unused receiver name on CustomNode.NodeKind. No functional impact.

v2/pkg/engine/resolve/node_array.go (1)

23-25: Ignore — unnamed method receivers are valid Go; do not apply these diffs

Go permits omitting the receiver identifier (e.g., func (*T) M()), and your ripgrep output shows many such occurrences (including generated protobufs). The suggested diffs are unnecessary — only consider func (_ *T) ... for handwritten code if you want a linter preference; do not change generated files.

Examples from your search:

  • v2/pkg/engine/resolve/node_array.go (original location)
  • v2/pkg/grpctest/productv1/product.pb.go (many generated methods)
  • v2/pkg/engine/plan/plan.go
  • v2/pkg/engine/resolve/node_object.go
  • v2/pkg/engine/resolve/node_scalar.go

Likely an incorrect or invalid review comment.

@ysmolski
Copy link
Contributor Author

I am not sure about this rule

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