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

DEV: Add upper limits for complexity #2108

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Aug 22, 2023

If we set upper limits then if someone wants to contribute more complex code then they need to justify in their pull request why they need messier code than is already in the codebase.

[tool.ruff.mccabe]
max-complexity = 54  # Recommended: 10

[tool.ruff.pylint]
allow-magic-value-types = ["bytes", "float", "int", "str"]
max-args = 12  # Recommended: 5
max-branches = 36  # Recommended: 12
max-returns = 11  # Recommended: 6
max-statements = 176  # Recommended: 50

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (89eb626) 94.13% compared to head (be0d7fa) 94.13%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2108   +/-   ##
=======================================
  Coverage   94.13%   94.13%           
=======================================
  Files          41       41           
  Lines        7387     7387           
  Branches     1460     1460           
=======================================
  Hits         6954     6954           
  Misses        269      269           
  Partials      164      164           
Files Changed Coverage Δ
pypdf/_text_extraction/__init__.py 93.27% <ø> (ø)
pypdf/generic/_utils.py 100.00% <100.00%> (ø)

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

@MartinThoma MartinThoma changed the title Ruff rules: Add some upper limits DEV: Add upper limits for complexity Aug 24, 2023
@MartinThoma MartinThoma merged commit 6ab1042 into py-pdf:main Aug 24, 2023
@MartinThoma
Copy link
Member

I agree that we should gradually converge to a codebase that is easier to read/understand, maintain, and extend. Thank you 🤗

@MartinThoma
Copy link
Member

If you want, I can add you to https://pypdf.readthedocs.io/en/latest/meta/CONTRIBUTORS.html :-)

@cclauss cclauss deleted the ruff-set-upper-limits branch August 24, 2023 21:49
cclauss added a commit to cclauss/pypdf that referenced this pull request Aug 25, 2023
MartinThoma pushed a commit that referenced this pull request Aug 25, 2023
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