-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added sorbet typecheck under python module on 5 files #11261
Conversation
0032c61
to
601f7de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to change the typed:true
to typed:strict
; see this example
Sure, I change it. |
1b814d7
to
6799716
Compare
6799716
to
bf7b0ec
Compare
aca58f5
to
955f98a
Compare
@@ -198,14 +198,15 @@ def setup_python_environment | |||
nil | |||
end | |||
|
|||
sig { params(package_manager: String, version: String).void } | |||
sig { params(package_manager: String, version: String).returns(T.nilable(T::Boolean)) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a nilable boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I also think all conditions are handled. It shouldn't be nillable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I corrected it now, thanks to both of you.
@@ -32,7 +33,7 @@ class FileParser < Dependabot::FileParsers::Base | |||
pipfile: "dev-packages", | |||
lockfile: "develop" | |||
} | |||
].freeze | |||
].freeze, T::Array[T::Hash[T.untyped, T.untyped]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested Change: Instead of using T::Hash[T.untyped, T.untyped]
, use T::Hash[Symbol, String]
(or another more specific type) to improve type safety and clarity.
Reasoning:
T.untyped
allows any type, which weakens Sorbet’s ability to provide meaningful type checks.- By specifying
Symbol
as the key type andString
as the value type (or another suitable type if necessary), you:- Make the code's intent clearer.
- Enable Sorbet to catch potential mismatches early.
- Provide better documentation for others reading or maintaining the code.
90c46ea
to
64be557
Compare
Since all the issues are fixed and due to time constraint , dismissing the review.
What are you trying to accomplish?
Requirement is to add Sorbet TypeCheck under Python module, Selected files are updated with TypeCheck.
Anything you want to highlight for special attention from reviewers?
TypeCheck are having correct data type params and return data type.
How will you know you've accomplished your goal?
Checklist