Skip to content
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

refactor(tools/hubl): don't use nil panic #20515

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

BabyHalimao
Copy link
Contributor

@BabyHalimao BabyHalimao commented Jun 1, 2024

if err != nil {
	panic(err)
}

Since err has been checked above, it's better to panic with a detailed error message instead of a nil

@BabyHalimao BabyHalimao requested a review from a team as a code owner June 1, 2024 06:33
@github-actions github-actions bot added the C:Hubl Tool: Hubl label Jun 1, 2024
Copy link
Contributor

coderabbitai bot commented Jun 1, 2024

Walkthrough

The change in tools/hubl/internal/compat.go involves updating a panic statement to use a deprecated field, ErrorResponse.String(), instead of directly using the error (err) in a switch case block. This adjustment ensures that the panic message utilizes the specific string representation of the error response.

Changes

File Path Change Summary
tools/hubl/internal/compat.go Updated panic statement to use ErrorResponse.String() instead of err.

Sequence Diagram(s) (Beta)

The changes do not introduce new features or significantly alter the control flow, so no sequence diagrams are necessary.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 1

Outside diff range and nitpick comments (7)
tools/hubl/internal/compat.go (7)

Line range hint 23-23: Consider removing or refactoring loadFileDescriptorsGRPCReflection if it's unused.

This function is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.


Line range hint 140-140: Consider removing or refactoring processFileDescriptorsResponse if it's unused.

This function is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.


Line range hint 154-154: Consider removing or refactoring missingFileDescriptors if it's unused.

This function is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.


Line range hint 166-166: Consider removing or refactoring addMissingFileDescriptors if it's unused.

This function is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.


Line range hint 211-211: Consider removing or refactoring guessAutocli if it's unused.

This function is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.


Line range hint 271-271: Consider removing or refactoring implMsgNameCleanup if it's unused.

This function is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.


Line range hint 283-283: Consider removing defaultAutocliMappings if it's unused.

This variable is flagged as unused by static analysis. If it's indeed not used, consider removing it to clean up the codebase. If it's mistakenly flagged, ensure it's properly integrated and tested.

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fda440d and afb6e59.

Files selected for processing (1)
  • tools/hubl/internal/compat.go (1 hunks)
Additional context used
Path-based instructions (1)
tools/hubl/internal/compat.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

golangci-lint
tools/hubl/internal/compat.go

23-23: func loadFileDescriptorsGRPCReflection is unused


271-271: func implMsgNameCleanup is unused


140-140: func processFileDescriptorsResponse is unused


154-154: func missingFileDescriptors is unused


166-166: func addMissingFileDescriptors is unused


211-211: func guessAutocli is unused


283-283: var defaultAutocliMappings is unused

tools/hubl/internal/compat.go Show resolved Hide resolved
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

Thanks!

@julienrbrt julienrbrt self-assigned this Jun 2, 2024
@julienrbrt julienrbrt added this pull request to the merge queue Jun 3, 2024
Merged via the queue into cosmos:main with commit 597fbb1 Jun 3, 2024
67 of 68 checks passed
@BabyHalimao BabyHalimao deleted the fix/panic-nil branch June 3, 2024 10:30
alpe added a commit that referenced this pull request Jun 3, 2024
* main:
  docs: add docs on permissions (#20526)
  refactor(x/gov): set environment in context for legacy proposals (#20521)
  docs: migrate diagrams to mermaidjs (#20503)
  refactor(tools/hubl): don't use nil panic (#20515)
  refactor(x/authz): set environment in context (#20502)
  build(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0 (#20519)
  feat(x/bank): Placing SendRestriction before Deduction of Coins in SendCoins (#20517)
  chore: sonar ignore directories with their own go.mods  (#20509)
  ci: run action in merge queue (#20508)
alpe added a commit that referenced this pull request Jun 3, 2024
* main:
  refactor(x/feegrant): set environment in context (#20529)
  refactor(x/accounts)!: accounts and auth module use the same account number tracking (#20405)
  chore: remove sonar from simapp (#20528)
  docs: add docs on permissions (#20526)
  refactor(x/gov): set environment in context for legacy proposals (#20521)
  docs: migrate diagrams to mermaidjs (#20503)
  refactor(tools/hubl): don't use nil panic (#20515)
  refactor(x/authz): set environment in context (#20502)
  build(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0 (#20519)
  feat(x/bank): Placing SendRestriction before Deduction of Coins in SendCoins (#20517)
  chore: sonar ignore directories with their own go.mods  (#20509)
  ci: run action in merge queue (#20508)
  refactor(server/v2/cometbft): update function comments (#20506)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Hubl Tool: Hubl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants