Skip to content

Prefer %v over %d,%s and add fmtpercentv custom linter#3756

Merged
gmlewis merged 4 commits into
google:masterfrom
gmlewis:add-url-percent-v-linter
Oct 6, 2025
Merged

Prefer %v over %d,%s and add fmtpercentv custom linter#3756
gmlewis merged 4 commits into
google:masterfrom
gmlewis:add-url-percent-v-linter

Conversation

@gmlewis

@gmlewis gmlewis commented Oct 4, 2025

Copy link
Copy Markdown
Collaborator

This PR formalizes the preference of %v over the use of %s or %d in this repo by adding a custom linter that enforces this preference.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@codecov

codecov Bot commented Oct 4, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.43537% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.11%. Comparing base (6195c56) to head (69c428e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
example/commitpr/main.go 0.00% 6 Missing ⚠️
example/actionpermissions/main.go 0.00% 5 Missing ⚠️
example/verifyartifact/main.go 0.00% 3 Missing ⚠️
example/listenvironments/main.go 0.00% 1 Missing ⚠️
example/ratelimit/main.go 0.00% 1 Missing ⚠️
github/repos_contents.go 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3756   +/-   ##
=======================================
  Coverage   91.11%   91.11%           
=======================================
  Files         187      187           
  Lines       16702    16702           
=======================================
  Hits        15218    15218           
  Misses       1296     1296           
  Partials      188      188           

☔ View full report in Codecov by Sentry.
📢 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 added the NeedsReview PR is awaiting a review before merging. label Oct 4, 2025
@gmlewis

gmlewis commented Oct 4, 2025

Copy link
Copy Markdown
Collaborator Author

@stevehipwell - @alexandear - @zyfy29 - might you have time for a code review? Thank you!

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@gmlewis gmlewis changed the title Prefer %v over %d,%s and add urlpercentv custom linter Prefer %v over %d,%s and add fmtpercentv custom linter Oct 5, 2025
Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@gmlewis

gmlewis commented Oct 5, 2025

Copy link
Copy Markdown
Collaborator Author

OK, great idea, @zyfy29! I've renamed urlpercentv to fmtpercentv and generalized it to lint all call expression format strings, not just ones involving assignments. This only flagged 3 perfectly valid lines in the entire repo, so I've gone ahead and added the //nolint comments to those.

PTAL.

@gmlewis

gmlewis commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator Author

Thank you, @zyfy29!
Merging.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Oct 6, 2025
@gmlewis gmlewis merged commit 4505771 into google:master Oct 6, 2025
6 of 7 checks passed
@gmlewis gmlewis deleted the add-url-percent-v-linter branch October 6, 2025 01:40
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
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