Skip to content

Add Ruff rule N802 (invalid-function-name) - #1263

Open
Abhayindia wants to merge 3 commits into
casact:mainfrom
Abhayindia:feature/ruff-n802
Open

Add Ruff rule N802 (invalid-function-name)#1263
Abhayindia wants to merge 3 commits into
casact:mainfrom
Abhayindia:feature/ruff-n802

Conversation

@Abhayindia

Copy link
Copy Markdown
Contributor

Summary of Changes

Adds the N802 rule (invalid-function-name).

Per the issue, the test-suite functions are renamed: test_OXDX_triangle -> test_oxdx_triangle, test_IBNR_methods -> test_ibnr_methods. Touching test_incremental.py pulls the whole file into the check, so it also drops an unused local and gets ruff format. test_1D_nanquantile in test_sparse.py is left for now - that file has ~70 other ruff violations, so its rename belongs with a full cleanup of it.

The codebase functions are excluded rather than renamed, for the "good reason" you mentioned:

  • _prep_X_ml, _check_X, validate_X use scikit-learn's uppercase-X design-matrix convention (validate_X and _prep_X_ml are also called across modules)
  • _G, G_ mirror Clark 2003's growth-function G (G_ appears in the ClarkLDF docstring's doctest)
  • _get_MCL_model / _get_MCL_resids / _get_MCL_lambda (Munich Chain Ladder), _fit_OLS / _fit_OLS_thru_orig, PTF_formula, pZlower are internal helpers using standard statistical abbreviations

chapter_7_part_2.ipynb's ExNShtN exhibit functions are excluded too (that file also overlaps with #1223).

Related GitHub Issue(s)

Closes #1237

Additional Context for Reviewers

ruff check / ruff format with N802 is clean project-wide apart from the grandfathered files. The two renamed tests pass locally.

@github-actions

github-actions Bot commented Sep 2, 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.2% of exported symbols fully typed (209 / 1377)

Known Ambiguous Unknown Total
Project (head) 209 111 1057 1377

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: 325
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 2); 2 no longer exported

Known Ambiguous Unknown Total
Patch 0 0 2 2
Patch symbol details
Symbol Status Change
chainladder.core.tests.test_triangle.test_oxdx_triangle ❌ unknown new
chainladder.development.tests.test_incremental.test_ibnr_methods ❌ unknown new
chainladder.core.tests.test_triangle.test_OXDX_triangle no longer exported (was ❌ unknown)
chainladder.development.tests.test_incremental.test_IBNR_methods no longer exported (was ❌ unknown)

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.70%. Comparing base (5f34bcd) to head (0f57cbf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1263   +/-   ##
=======================================
  Coverage   91.70%   91.70%           
=======================================
  Files          93       93           
  Lines        5435     5435           
  Branches      699      699           
=======================================
  Hits         4984     4984           
  Misses        327      327           
  Partials      124      124           
Flag Coverage Δ
unittests 91.70% <ø> (ø)

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

Copy link
Copy Markdown
Member

looks good. please resolve conflict

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 Ruff rule: invalid-function-name (N802)

2 participants