Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .cursor/rules/docs.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
description:
globs:
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

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

The description and globs fields are currently empty in the rule configuration. For the rule to function properly:

  1. Add a descriptive summary to the description field (e.g., "Enforces Google-style docstrings for Python code")
  2. Specify target files in the globs field (e.g., "*.py") to define which files this rule should apply to

While alwaysApply: true is set, explicitly defining these fields will improve rule clarity and maintainability.

Suggested change
description:
globs:
description: "Enforces Google-style docstrings for Python code"
globs: "*.py"

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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._
Copy link
Contributor

Choose a reason for hiding this comment

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

There appears to be a typo in the note: Inclide should be Include.

Suggested change
_Note: Inclide ` # noqa: E501` to avoid conflicts with CI._
_Note: Include ` # noqa: E501` to avoid conflicts with CI._

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.


## 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`
Copy link
Contributor

Choose a reason for hiding this comment

The 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 - For unions use type1 or type2``

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Loading