-
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix returns #13
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 returns #13
Conversation
Reviewer's Guide by SourceryThis pull request refactors tests to use pytest.mark.parametrize, implements checks for incorrect 'Returns' section names and missing return type annotations in the docstring checker tool, improves the parsing and validation of the Returns section in Google-style docstrings, updates ruff pre-commit hook to v0.11.2, and enhances type validation and bracket checking in type annotations. Sequence diagram for _process_docstring functionsequenceDiagram
participant Context as DocstringContext
participant _process_docstring
participant check_returns_section_name
participant validate_docstring
participant parse_google_docstring
participant check_param_types
participant check_references
_process_docstring->>Context: Get context
_process_docstring->>check_returns_section_name: Check Returns section name
check_returns_section_name-->>_process_docstring: Return errors
_process_docstring->>validate_docstring: Validate docstring
validate_docstring-->>_process_docstring: Return errors
_process_docstring->>parse_google_docstring: Parse docstring
parse_google_docstring-->>_process_docstring: Return parsed docstring
alt context.require_param_types
_process_docstring->>check_param_types: Check parameter types
check_param_types-->>_process_docstring: Return errors
end
alt context.check_references
_process_docstring->>check_references: Check references
check_references-->>_process_docstring: Return errors
end
Updated class diagram for DocstringContextclassDiagram
class DocstringContext {
file_path: Path
verbose: bool
require_param_types: bool
check_references: bool
}
note for DocstringContext "A named tuple containing docstring processing context"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Pull Request Overview
This PR fixes returns handling in docstrings and enhances type annotations and docstring validations across various modules. Key changes include updated and more descriptive return type annotations in functions and classes, refactored docstring processing functions, and improvements to related tests and configuration files.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/check_docstrings.py | Updated function docstrings and refactored returns and validations. |
| tools/init.py | Minor changes to module docstrings. |
| tests/test_type_validation_edge_cases.py | Adjusted parameterizations for testing invalid and mixed types. |
| tests/test_parser.py | Updated expected return structures in parsing tests. |
| tests/test_docstring_checker/*.py | Refined expected docstring outputs and type hints in test cases. |
| tests/test_brackets_validation.py | Expanded tests for bare collection detection. |
| google_docstring_parser/type_validation.py | Added return annotations in error constructors and helper functions. |
| google_docstring_parser/google_docstring_parser.py | Updated returns section processing and overall docstring parsing logic. |
| google_docstring_parser/init.py | Minimal docstring updates. |
| README.md | Updated example content to reflect new returns information. |
| .pre-commit-config.yaml | Upgraded ruff version. |
Comments suppressed due to low confidence (1)
README.md:83
- There is an extra double quote in the 'Returns' key which makes the syntax invalid. Please remove the extra quote so the key is formatted correctly as 'Returns':.
'Returns':"
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 @ternaus - I've reviewed your changes - here's some feedback:
Overall Comments:
- The changes look good overall, but consider adding a brief explanation of the changes in the description.
- The use of parametrize is great for these tests, but consider renaming
test_invalid_case_sensitivitytotest_case_sensitivity_invalidandtest_valid_case_sensitivitytotest_case_sensitivity_validfor clarity.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 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.
Summary by Sourcery
Improve docstring parsing and validation with enhanced type checking and error handling
Bug Fixes:
Enhancements:
Tests: