Skip to content

[CHORE] Implementing ruff rule D213 + misc formatting - #1361

Merged
henrydingliu merged 6 commits into
casact:mainfrom
henrydingliu:ruff_dunders
Sep 15, 2026
Merged

henrydingliu merged 6 commits into
casact:mainfrom
henrydingliu:ruff_dunders

Conversation

@henrydingliu

@henrydingliu henrydingliu commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary of Changes

adding D213 and addressing in a handful of files
ruff formatting a couple of files

Related GitHub Issue(s)

#1277

AI/LLM Usage

I used the formatter in my IDE to help. I don't think the formatter uses AI.

Additional Context for Reviewers

there are a few spots where the formatter would make the code less readable. so i just use block-ignore to preserve

Submitter's Checklist

  • I have reviewed and am adhering to the standards outlined in the project Governing Doc.
  • The PR subject title summarizes the changes, with one proper prefix ([FIX], [FEAT], [DOCS], [TST], [CHORE], or [BRK]).
  • I am a human (not a bot), and this PR form is written by a human.

Reviewer's Checklist

  • The implementation addresses the associated issue(s).
  • The implementation is appropriate, maintainable, and follows ARCHITECTURE.md.
  • PR subject title has the proper prefix and the subject is appropriate.
  • Relevant issue(s) are linked.
  • AI/LLM usage is disclosed and appropriate.
  • Documentation and tests are appropriate.
  • CI tests passed, or any failures are acceptable.
  • Leave a comment with the final recommendation (e.g. approve as is, request a secondary review, or flag an area for more review).

Note

Low Risk
Documentation and formatting-only changes with no runtime logic modifications.

Overview
This PR aligns docstrings and a few hot spots with Ruff formatting and enables lint rule D213, which expects multi-line docstrings to put the summary on the line after the opening """.

Across adjustments (bootstrap, disposal, parallelogram, trend), core modules (base, common, dunders, io, pandas), and one parallelogram test, docstrings are reflowed to that style without changing wording. dunders.py also wraps grouped arithmetic helpers and _get_key_union in # fmt: off blocks so the formatter does not split those expressions. io.py gets minor chain-expression wrapping in to_json and trivial class-docstring spacing.

No API or algorithm changes—only style and lint configuration.

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

@github-actions

github-actions Bot commented Sep 15, 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 (208 / 1382)

Known Ambiguous Unknown Total
Project (head) 208 111 1063 1382

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: 327
  • 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.

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.76%. Comparing base (320d0b3) to head (c4a9383).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1361   +/-   ##
=======================================
  Coverage   91.76%   91.76%           
=======================================
  Files          96       96           
  Lines        5475     5475           
  Branches      706      706           
=======================================
  Hits         5024     5024           
  Misses        327      327           
  Partials      124      124           
Flag Coverage Δ
unittests 91.76% <100.00%> (ø)

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.

@henrydingliu
henrydingliu marked this pull request as ready for review September 15, 2026 14:24
@genedan

genedan commented Sep 15, 2026

Copy link
Copy Markdown
Member

Could we expand this to add #1277? We can just get this rule done across all the files now.

@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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d9fb20d. Configure here.

Comment thread pyproject.toml
@henrydingliu
henrydingliu marked this pull request as draft September 15, 2026 17:29
@henrydingliu

Copy link
Copy Markdown
Member Author

Could we expand this to add #1277? We can just get this rule done across all the files now.

rule added on a temporary basis

@genedan can you help me understand why the PR ruff run isn't catching the D213 violations on unchanged files?

the push ruff run shows around 150 violations. while those fixes are quick by themselves, making a change in a couple dozen files will trigger ruff format to fail on all those files. at that point this becomes a humongous PR.

let me know if you'd like me to take off D213 (for a later implementation) or go through the ruff format on pretty much the whole repo now

@genedan

genedan commented Sep 15, 2026

Copy link
Copy Markdown
Member

Oh yeah...we need to do 2 things:

  • Remove the last 2 "grandfathered" files in pyproject.toml
  • Remove the part of the workflow in ruff.yml that only checks the patch

The first task touches the remaining Friedland notebooks. Could you take on the first one? Then I could do part 2?

This will trigger a large number files that still need to be edited. Maybe it's like 40-50 files but I believe the number of lines changed per file will be quite small, and much more manageable than before.

Before that, we can merge this PR after you make just enough edits to get that Ruff check to pass.

@henrydingliu

Copy link
Copy Markdown
Member Author

The first task touches the remaining Friedland notebooks. Could you take on the first one? Then I could do part 2?

Priyam had a PR fixing those, which I already approved (but didn't merge prior to his abduction). I'd like to wait another day or so to see if that PR reappears.

What I don't understand is what's the per-file ignore actually doing presently?

This will trigger a large number files that still need to be edited. Maybe it's like 40-50 files but I believe the number of lines changed per file will be quite small, and much more manageable than before.

you can check out the ruff format run in the push ruff workflow. it's currently standing at around 4000 lines of log. so say 1000 lines of actual changes. definitely not quite small. i would still recommend a more organic approach at this point in time.

Before that, we can merge this PR after you make just enough edits to get that Ruff check to pass.

I can fix the 150 or so D213 violations and get the linter to pass. are you okay with the formatter not passing?

@cursor cursor Bot mentioned this pull request Sep 15, 2026
11 tasks
@genedan

genedan commented Sep 15, 2026

Copy link
Copy Markdown
Member

I can fix the 150 or so D213 violations and get the linter to pass. are you okay with the formatter not passing?

Would you be able to run Ruff format on just these three files?

you can check out the ruff format run in the push ruff workflow. it's currently standing at around 4000 lines of log. so say 1000 lines of actual changes. definitely not quite small. i would still recommend a more organic approach at this point in time.

I made a PR #1364 to give you an idea on what a "bandaid rip" would look like. The majority of the line changes comes from just this one notebook:

image

If you think that's manageable, we could go for it, but if you want to break it up, there are various approaches. The non-notebook changes isn't too much. Maybe 1 PR for non-notebook, then we spilt up the notebooks and work on those individually?

@henrydingliu
henrydingliu marked this pull request as ready for review September 15, 2026 20:49
@henrydingliu

Copy link
Copy Markdown
Member Author

Would you be able to run Ruff format on just these three files?

i did a few that didn't have format changes

The majority of the line changes comes from just this one notebook:

lol, Priyam was working on a fix for this too

@henrydingliu henrydingliu changed the title [CHORE] Ruff format for dunders and io [CHORE] Implementing ruff rule D213 + misc formatting Sep 15, 2026
@henrydingliu
henrydingliu merged commit a369204 into casact:main Sep 15, 2026
13 checks passed
@henrydingliu
henrydingliu deleted the ruff_dunders branch September 16, 2026 03:01
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