From 04d062c6abe82a21417cf96c52bd8b791a96007a Mon Sep 17 00:00:00 2001 From: Sebastian Sosa <1sebastian1sosa1@gmail.com> Date: Mon, 28 Apr 2025 02:32:52 -0400 Subject: [PATCH] cursor rules for consistent quality docstring production --- .cursor/rules/docs.mdc | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .cursor/rules/docs.mdc diff --git a/.cursor/rules/docs.mdc b/.cursor/rules/docs.mdc new file mode 100644 index 0000000000..a1f267075a --- /dev/null +++ b/.cursor/rules/docs.mdc @@ -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._ + +## 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` \ No newline at end of file