-
Notifications
You must be signed in to change notification settings - Fork 170
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
Lint idea: top-level final
/const
variable defined without explicit type
#5100
Comments
Summary: The issue proposes a new lint rule that flags top-level |
Thanks for the request. It isn't clear if you are concerned specifically about local variables or top-level variables, but we have the following existing rules:
What you are asking for might be akin to the "DO type annotate fields and top-level variables if the type isn't obvious" rule, for which we appear to not have a backing lint rule. |
Note that |
I'm moreso concerned with top-level variables here.
That is more or less what I actually want, but the To explain my thinking some more, I'd be fine with an obvious assumed type like |
This would be a nice-to-have opt-in lint. Can helpful when handling more complex types.
Rationale: increases code readability (especially for code reviews, when you don't have an IDE handy) by having type information specified explicitly in the source code. While it is sometimes obvious (like in the case of the
const int i = 0
above), it is fairly useful when dealing with non-obvious types.The text was updated successfully, but these errors were encountered: