Skip to content

Static analyzer for httputil.HandleError calls#16134

Merged
james-prysm merged 4 commits into
developfrom
httperror-analyzer
Dec 12, 2025
Merged

Static analyzer for httputil.HandleError calls#16134
james-prysm merged 4 commits into
developfrom
httperror-analyzer

Conversation

@rkapka

@rkapka rkapka commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

What type of PR is this?

Tooling

What does the PR do?

Every call to httputil.HandleError must be followed by a return statement. It's easy to miss this during reviews, so having a static analyzer that enforces this will make our life easier.

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have included a uniquely named changelog fragment file.
  • I have added a description with sufficient context for reviewers to understand this PR.
  • I have tested that my changes work as expected and I added a testing plan to the PR description (if applicable).

@rkapka rkapka changed the title Httperror analyzer Static analyzer for httputil.HandleError calls Dec 11, 2025
return duties, vals, nil
}

func sortProposerDuties(w http.ResponseWriter, duties []*structs.ProposerDuty) bool {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Calling httputil.HandleError inside of sort.Slice doesn't seem like a good idea. I think it's clearer to return a regular error from sortProposerDuties and handle the error in the caller.

@rkapka rkapka added this pull request to the merge queue Dec 12, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Dec 12, 2025
@james-prysm james-prysm added this pull request to the merge queue Dec 12, 2025
Merged via the queue into develop with commit be300f8 Dec 12, 2025
18 checks passed
@james-prysm james-prysm deleted the httperror-analyzer branch December 12, 2025 21:46
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.

3 participants