Skip to content

Refactor verify_external_req for readability #161

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

Merged
merged 5 commits into from
Mar 3, 2025
Merged

Conversation

srittau
Copy link
Member

@srittau srittau commented Feb 25, 2025

While trying to review #159, I found the verify_external_req() function very hard to understand and to follow its logic. It has multiple early exits, and understanding what the individual checks do (and where they end) is not trivial. In fact, I think a bug or two hides in the function.

Therefore, this PR extracts the individual checks, and reorders the logic to prevent early exist to make it easier to follow.

@Avasam: Do you want to review this? After this is merged, you'd have to adapt #159, but I promise to review it promptly.

Split individual checks into separate functions
srittau

This comment was marked as spam.

@Avasam
Copy link
Contributor

Avasam commented Feb 25, 2025

I'll be really occupied for the next 2 days. So it depends if I find the energy. But can review by the end of the week if no one beats me to it!

Copy link
Contributor

@Avasam Avasam left a comment

Choose a reason for hiding this comment

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

This is a nice split of a complicated function ! As far as I can tell, the logic should all be the same.
I also appreciate the name change to validate_pypi_response to make it less ambiguous.

I have 1 suggested improvement and 1 nitpick. Neither are blockers. Otherwise LGTM.

@srittau srittau requested a review from Avasam March 3, 2025 15:08
@srittau srittau merged commit 0415e8d into main Mar 3, 2025
6 checks passed
@srittau srittau deleted the refactor-verify-ext-deps branch March 3, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants