Skip to content

refactor: Fix parameters in method endpoints#4300

Open
alexandear wants to merge 6 commits into
google:masterfrom
alexandear-org:refactor/requestbody-name
Open

refactor: Fix parameters in method endpoints#4300
alexandear wants to merge 6 commits into
google:masterfrom
alexandear-org:refactor/requestbody-name

Conversation

@alexandear

@alexandear alexandear commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

This PR adds the paramcheck custom linter that detects issues with body and query parameters. Changes are non-breaking.

The paramcheck does the following:

  • suggests renaming a body parameter to body
  • reports body parameters passed by pointer, because body parameters are usually required
  • reports body parameter types with an Options suffix, because Options are used for query parameters
  • suggests renaming a query struct to opts
  • reports query parameter passed by value, because query parameters are usually optional
  • reports query parameter types without an Options suffix

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.43182% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.47%. Comparing base (0eacd34) to head (b2ad890).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
github/codespaces_secrets.go 85.71% 0 Missing and 2 partials ⚠️
github/git_refs.go 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4300   +/-   ##
=======================================
  Coverage   97.47%   97.47%           
=======================================
  Files         192      192           
  Lines       19310    19310           
=======================================
  Hits        18822    18822           
  Misses        270      270           
  Partials      218      218           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis

gmlewis commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

I'm wondering if we should standardize on an "Options" suffix for query (URL) parameters at the same time since we are standardizing on a "Request" suffix for body parameters?

If so, it seems to me like this new linter is the perfect place to put this.

Thoughts?

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Jun 14, 2026
@alexandear

Copy link
Copy Markdown
Contributor Author

I'm wondering if we should standardize on an "Options" suffix for query (URL) parameters at the same time since we are standardizing on a "Request" suffix for body parameters?

If so, it seems to me like this new linter is the perfect place to put this.

Thoughts?

Agree, good idea. I'll extend the linter.
Also should think of a better name for the linter.

@alexandear alexandear changed the title refactor: Standardize body parameter names refactor: Fix parameters in method endpoints Jun 16, 2026
@alexandear

Copy link
Copy Markdown
Contributor Author

@gmlewis I extended the linter, ready for review.

The linter found a few more problems, created #4301.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @alexandear!
Two tiny nits, otherwise LGTM.

cc: @stevehipwell - @zyfy29 - @Not-Dhananjay-Mishra

Comment thread .custom-gcl.yml
Comment thread .golangci.yml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants