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

Remove "Enum casts" #8418

Open
itaigilo opened this issue Dec 13, 2024 · 0 comments
Open

Remove "Enum casts" #8418

itaigilo opened this issue Dec 13, 2024 · 0 comments
Labels
go Pull requests that update Go code tech-debt

Comments

@itaigilo
Copy link
Contributor

In some places in our code, we have "enum-like" string or int types (for example, see LocalOperation), which "expects" values from a pre-defined list (in the LocalOperation example, we have commitOperation, pullOperation, etc.).

Casting strings or integers into such types creates buggy flow, so we should avoid such explicit casts.
Any cast must either go through an appropriately named func with error checking, or be accompanied by a comment re-explaining why it is valid.

This Issue is about detecting all such occurrences in our code, and fixing them to follow the "named-func-or-comment" rule above.

@itaigilo itaigilo added tech-debt go Pull requests that update Go code labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code tech-debt
Projects
None yet
Development

No branches or pull requests

1 participant