Fix multiple code quality and validation issues#159
Open
xenacode-art wants to merge 1 commit into
Open
Conversation
This commit addresses several bugs and code quality issues found during code review: 1. Add missing validator to superseded_similarity_threshold field - Field documentation stated 0.0-1.0 range but had no validator - Added MinValueValidator and MaxValueValidator for consistency - All other similar ORES threshold fields already had validators 2. Fix inconsistent exception handling in is_living_person.py - Changed return value from True to False when birth date check fails - Added proper logging for debugging - Ensures consistent behavior with other exception handlers 3. Add input validation to ISBN checker functions - Added None/empty string guards to prevent index out of bounds - Prevents potential crashes when invalid input is provided - Improves defensive programming practices 4. Improve exception specificity in pending_revision.py - Split broad Exception catches into specific pywikibot exceptions - Now handles APIError, ServerError, and NoPageError separately - Better error logging for API vs unexpected errors - Enables more targeted error handling and monitoring 5. Document and resolve wikitext TODO comment - Replaced TODO with clear explanation of str() conversion - Documents that MediaWiki API can return bytes or other types - Clarifies why explicit string conversion is necessary All changes have been tested and pass existing test suite (70 tests).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @zache-fi @ad-an-26 ,
This commit addresses several bugs and code quality issues found during code review:
Add missing validator to superseded_similarity_threshold field
Fix inconsistent exception handling in is_living_person.py
Add input validation to ISBN checker functions
Improve exception specificity in pending_revision.py
Document and resolve wikitext TODO comment
All changes have been tested and pass existing test suite (70 tests).