-
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
Fix added for sorbet type strict. #11754
Fix added for sorbet type strict. #11754
Conversation
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.
PR Overview
This pull request updates the typed level for the Python requirement parser file to use Sorbet’s strict mode and adds explicit type signatures to many methods.
- Updated the Sorbet type directive from "true" to "strict".
- Added and updated type signatures (sig) for various methods throughout the file.
- Adjusted handling of nullable values using T.must and T.nilable.
Reviewed Changes
File | Description |
---|---|
python/lib/dependabot/python/file_parser/python_requirement_parser.rb | Modified type annotations and method signatures to support Sorbet strict mode |
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
python/lib/dependabot/python/file_parser/python_requirement_parser.rb:142
- This change removes memoization of the pyenv versions, causing the command to run on every invocation. Consider reverting to the memoization pattern (using ||=) to improve performance if caching is intended.
@pyenv_versions = T.let(run_command("pyenv install --list"), T.nilable(String))
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
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.
PR Overview
This PR changes the Sorbet typing level from "true" to "strict" and adds detailed T::Sig method signatures throughout the PythonRequirementParser to improve type safety. Additionally, it replaces direct content calls with T.must wrappers for better type checking.
- Updated Sorbet typing directive
- Added method signatures using T::Sig
- Modified file content accesses to use T.must for type assurance
Reviewed Changes
File | Description |
---|---|
python/lib/dependabot/python/file_parser/python_requirement_parser.rb | Introduces Sorbet strict mode and adds method signatures; updates file content access with T.must calls |
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
python/lib/dependabot/python/file_parser/python_requirement_parser.rb:156
- Replacing the ||= memoization with a direct assignment causes a new PipCompileFileMatcher to be created on every call, which may not be intended. Consider using memoization to instantiate it only once.
@pip_compile_file_matcher = T.let(PipCompileFileMatcher.new(pip_compile_files), T.nilable(PipCompileFileMatcher))
Tip: Leave feedback on Copilot's review comments with the 👎 and 👍 buttons to help improve review quality. Learn more
a571a49
to
6927339
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.
I think we can improve these untyped
sigils
python/lib/dependabot/python/file_parser/python_requirement_parser.rb
Outdated
Show resolved
Hide resolved
python/lib/dependabot/python/file_parser/python_requirement_parser.rb
Outdated
Show resolved
Hide resolved
6927339
to
14e2cea
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.
LGTM
Thanks
169c187
to
616b3c4
Compare
What are you trying to accomplish?
Anything you want to highlight for special attention from reviewers?
How will you know you've accomplished your goal?
Checklist