Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document areas of code complexity #2370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Feb 19, 2025

As discussed at #2360 (review), let's set upper limits on or at least document code complexity.

Ruff provides one McCabe metric and four Pylint refactor metrics (even more in --preview mode).

This pull request shows three ways to document where code complexity exists.

  1. noqa plus a few lines in the docstring. (Semi-automated generation with a script.)
  2. Just noqa.
  3. tool.ruff.lint.per-file-ignores in pyproject.toml

On the main branch...

% ruff check --select=C90,PLR09 --statistics

22	PLR0913	too-many-arguments
17	C901   	complex-structure
16	PLR0912	too-many-branches
13	PLR0915	too-many-statements
 2	PLR0911	too-many-return-statements

% ruff check --select=C90,PLR09 --statistics --preview

22	PLR0913	too-many-arguments
22	PLR0917	too-many-positional-arguments
17	C901   	complex-structure
16	PLR0912	too-many-branches
13	PLR0915	too-many-statements
10	PLR0914	too-many-locals
 5	PLR0916	too-many-boolean-expressions
 2	PLR0911	too-many-return-statements

@cclauss cclauss marked this pull request as draft February 19, 2025 13:35
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.16%. Comparing base (3305894) to head (b1932a1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2370   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files          40       40           
  Lines        3101     3101           
  Branches      680      680           
=======================================
  Hits         3075     3075           
  Misses         15       15           
  Partials       11       11           

@cclauss cclauss force-pushed the set-limits-to-code-complexity branch 2 times, most recently from 1aef429 to ade3306 Compare February 19, 2025 14:14
@cclauss cclauss force-pushed the set-limits-to-code-complexity branch 2 times, most recently from e0ba84d to a9f5d08 Compare February 21, 2025 12:15
@cclauss cclauss force-pushed the set-limits-to-code-complexity branch from a9f5d08 to b1932a1 Compare February 21, 2025 12:17
@cclauss cclauss marked this pull request as ready for review February 21, 2025 12:23
@cclauss cclauss changed the title DRAFT: Document areas of code complexity Document areas of code complexity Feb 21, 2025
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.

1 participant