Skip to content

Enforce return-type annotations via ANN2 ruff rule#385

Merged
tschm merged 4 commits intomainfrom
copilot/add-return-type-annotations
Mar 23, 2026
Merged

Enforce return-type annotations via ANN2 ruff rule#385
tschm merged 4 commits intomainfrom
copilot/add-return-type-annotations

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

All public methods in src/jquantstats/ already carry explicit return-type annotations. This PR adds lint-time enforcement so future contributions cannot omit them.

Changes

  • ruff.toml — adds "ANN2" to extend-select, enabling the full flake8-annotations return-type rule group (ANN201ANN206) across src/
  • ruff.toml per-file-ignores — suppresses ANN for tests/** and **/marimo/** where annotation conventions differ (fixtures, notebook cell functions)
  • book/marimo/*.py-> None: added to cell functions auto-fixed by ruff --fix during the fmt pass

Effect

Any new function added to src/ without a return-type annotation now fails the ruff lint gate:

# ruff: ANN201 Missing return type annotation for public function
def volatility(self, series: pl.Series):   # ← lint error
    ...

# correct
def volatility(self, series: pl.Series) -> float:
    ...
Original prompt

This section details on the original issue you should resolve

<issue_title>Add return-type annotations to all public methods — Stats methods return float, pl.DataFrame, or pl.Series — all should be explicitly annotated</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Add return-type annotations to all public methods Enforce return-type annotations via ANN2 ruff rule Mar 23, 2026
Copilot AI requested a review from tschm March 23, 2026 10:33
@tschm tschm marked this pull request as ready for review March 23, 2026 10:45
@tschm tschm merged commit 30d200c into main Mar 23, 2026
21 checks passed
@tschm tschm deleted the copilot/add-return-type-annotations branch March 23, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add return-type annotations to all public methods — Stats methods return float, pl.DataFrame, or pl.Series — all should be explicitly annotated

2 participants