-
Notifications
You must be signed in to change notification settings - Fork 4
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
colophons fix #576
colophons fix #576
Conversation
Reviewer's Guide by SourceryThis pull request implements improvements to the colophon name search functionality in the ebl (Electronic Babylonian Library) project. It refactors the existing code to enhance the search capabilities and adds support for collation in the query process. Class diagram for MongoFragmentRepositoryGetExtendedclassDiagram
class MongoFragmentRepositoryGetExtended {
+fetch_names(name_query: str) List~str~
}
MongoFragmentRepositoryGetExtended --> CollatedFieldQuery
class CollatedFieldQuery {
+value: str
}
class MongoFragmentRepositoryBase {
}
MongoFragmentRepositoryGetExtended --> MongoFragmentRepositoryBase
note for MongoFragmentRepositoryGetExtended "Refactored fetch_names method to use _get_colophon_names_query and CollatedFieldQuery."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Code Climate has analyzed commit d06fb38 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (75% is the threshold). This pull request will bring the total coverage in the repository to 91.4% (0.0% change). View more on Code Climate. |
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.
Hey @khoidt - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider providing a justification for the minimum length requirement (len(name_query) < 3) in fetch_names, or consider if this limitation is necessary. It might prevent some valid use cases.
- In Fields.findByDataType, consider updating the error message for invalid data types to include the new 'colophons' type for completeness.
- Good job on refactoring the colophon name query logic and extending the functionality. The code organization has improved, and the new test case with the macron character is a nice touch.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
{"$sort": {"unique_names": 1}}, | ||
{"$project": {"_id": 0, "name": "$unique_names"}}, | ||
] | ||
if len(name_query) < 3: |
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.
suggestion: Consider making the minimum query length configurable
While this check is a good optimization, hardcoding the value '3' might not be flexible enough for all use cases. Consider making this a configurable parameter, perhaps defined in a configuration file or as a class constant.
MIN_QUERY_LENGTH = 3 # Consider moving this to a configuration file
if len(name_query) < MIN_QUERY_LENGTH:
return []
|
||
|
||
def has_none_values(dictionary: dict) -> bool: | ||
return not all(dictionary.values()) | ||
|
||
|
||
def _get_colophon_names_query(name_regex: str) -> Sequence[dict]: |
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.
suggestion: Add comments explaining each stage of the pipeline
The pipeline in this function is quite complex. Consider adding inline comments to explain the purpose of each stage in the pipeline. This would greatly improve readability and maintainability.
Summary by Sourcery
Fix the colophon name query to handle short query strings and refactor the query logic into a separate function for better code organization. Update tests to cover the new query behavior.
Bug Fixes:
Enhancements:
Tests: