Skip to content

[TST] Add E2 ruleset to Ruff, doctest to pre-commit checks. - #1204

Merged
genedan merged 14 commits into
mainfrom
#651_ruff
Aug 14, 2026
Merged

[TST] Add E2 ruleset to Ruff, doctest to pre-commit checks.#1204
genedan merged 14 commits into
mainfrom
#651_ruff

Conversation

@genedan

@genedan genedan commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary of Changes

Adds whitespace rules to Ruff (E2 ruleset). I'm also adding our existing doctest to pre-commit, which was missing before.

Related GitHub Issue(s)

#651

Additional Context for Reviewers

#1203 was a false alarm, the two JSON files actually had changes due to changes in main. I believe these two files were supposed to be committed in a previous PR but were left out, so I checked them in.

Checklist

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run --directory docs jb build . --builder=custom --custom-builder=doctest)

Note

Medium Risk
JSON golden files and broad lint policy affect CI and numerical test expectations; doctest on every pre-push adds developer friction but does not change runtime behavior.

Overview
Ruff now enforces the E2 whitespace ruleset (with preview on), excludes the invalid-syntax sandbox notebook, and expands per-file-ignores across library code, tests, and docs notebooks so existing violations stay grandfathered. CI and local hooks run Ruff on changed *.py and *.ipynb with --force-exclude, and the GitHub workflow fixes empty diffs on main pushes by diffing against github.event.before with fallbacks.

Pre-commit consolidates hooks into one local repo: Ruff on pre-push diffs vs origin/main (replacing the astral hook), plus a new doctest step that runs sphinx-autogen and the Jupyter Book custom doctest builder.

Test fixtures friedland_ch7_xyz_paid.json and friedland_ch7_xyz_reported.json are updated (Mack-related sub-triangle values). ARCHITECTURE.md is refreshed for current package layout; .gitignore gets a trailing newline on .vscode/.

Reviewed by Cursor Bugbot for commit 264bd3d. Bugbot is set up for automated code reviews on this repo. Configure here.

chapter_7.rst's doctest block refits and overwrites these files on every
docs build, so tracking them in git made every doctest run look like an
uncommitted change and fail the pre-push hook.
Adds py.typed, correlation.py, disposal.py, core/README.md, and
test_architecture.py so test_package_directories_have_no_undocumented_members
passes. This file was previously left unstaged, so pre-commit's stash/restore
around hook runs was testing against the stale, undocumented version.
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 15.1% of exported symbols fully typed (201 / 1333)

Known Ambiguous Unknown Total
Project (head) 201 111 1021 1333

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 321
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected.

Comment thread .pre-commit-config.yaml
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.25%. Comparing base (52be42a) to head (264bd3d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1204   +/-   ##
=======================================
  Coverage   91.25%   91.25%           
=======================================
  Files          91       91           
  Lines        5400     5400           
  Branches      691      691           
=======================================
  Hits         4928     4928           
  Misses        338      338           
  Partials      134      134           
Flag Coverage Δ
unittests 91.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .github/workflows/ruff.yml
Comment thread pyproject.toml
henrydingliu
henrydingliu previously approved these changes Aug 13, 2026
# Conflicts:
#	pyproject.toml
Comment thread .pre-commit-config.yaml

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e191e5f. Configure here.

Comment thread .github/workflows/ruff.yml
@priyam0k priyam0k mentioned this pull request Aug 14, 2026
1 task

@henrydingliu henrydingliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

checked new commits

@genedan
genedan merged commit 272cbe1 into main Aug 14, 2026
24 checks passed
@genedan
genedan deleted the #651_ruff branch August 14, 2026 15:07
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.

2 participants