-
Notifications
You must be signed in to change notification settings - Fork 488
ci: cursor rules for consistent quality docstring production #7316
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,52 @@ | ||||||
--- | ||||||
description: | ||||||
globs: | ||||||
alwaysApply: true | ||||||
--- | ||||||
# Docstring Style Guide | ||||||
|
||||||
All functions, methods, and classes must be documented using Google-style docstrings. | ||||||
|
||||||
## Required Format | ||||||
|
||||||
```python | ||||||
def function_name(param1: type, param2: type) -> type: | ||||||
""" | ||||||
Brief summary of what the function does in one line. | ||||||
|
||||||
More detailed explanation if needed. | ||||||
|
||||||
Args: | ||||||
param1 (type): Description of param1. | ||||||
Include details on multiple lines if needed. | ||||||
param2 (type, optional): Description of param2. Default is None. | ||||||
|
||||||
Returns: | ||||||
return_type: Description of the return value. | ||||||
|
||||||
Raises: | ||||||
ExceptionType: When and why this exception is raised. | ||||||
""" # noqa: E501 | ||||||
``` | ||||||
_Note: Inclide ` # noqa: E501` to avoid conflicts with CI._ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There appears to be a typo in the note:
Suggested change
Spotted by Diamond |
||||||
|
||||||
## Section Guidelines | ||||||
|
||||||
1. Start with a brief one-line summary | ||||||
2. Follow with a more detailed explanation if needed (separated by blank line) | ||||||
3. Use the following sections as needed: | ||||||
- `Args:` - For function/method parameters | ||||||
- `Returns:` - For return values | ||||||
- `Raises:` - For exceptions | ||||||
- `Attributes:` - For class attributes | ||||||
- `Examples:` - For usage examples | ||||||
|
||||||
## Parameter Documentation | ||||||
- Format: `param_name (type): Description` | ||||||
- Include default values in the description: `(type, optional): Description. Default is value.` | ||||||
- Indent continuation lines with 4 spaces | ||||||
|
||||||
## Types | ||||||
- Use Python type annotations in function signatures | ||||||
- Use descriptive types in docstrings (`dict` instead of `Dict`, etc.) | ||||||
- For unions use `type1 or type2` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file is missing a newline at the end, which is a common standard in text files. Adding a newline after the last line will ensure compatibility with various tools and follow standard file formatting conventions. This can be fixed by simply adding an empty line after Spotted by Diamond |
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.
The
description
andglobs
fields are currently empty in the rule configuration. For the rule to function properly:description
field (e.g.,"Enforces Google-style docstrings for Python code"
)globs
field (e.g.,"*.py"
) to define which files this rule should apply toWhile
alwaysApply: true
is set, explicitly defining these fields will improve rule clarity and maintainability.Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.