Skip to content

Set upper limits on code complexity #6339

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

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 28, 2025

Thank you for contributing to Pipenv!

The issue

Disabling ruff rules PLR0912 and PLR0913 has disabled the limits on code complexity ruff.lint.pylint.max-args (which has now doubled) and ruff.lint.pylint.max-branches (which has increased by 14). Using numbers forces discussion in code reviews about why the increase in complexity is good for the project. Disabling the rules blinds maintainers to pull requests that increase code complexity. Refactoring functions to make them less complex improves the project's maintainability.

Upgrade to ruff to the current v0.9.3 and also enforce collapsible-else-if (PLR5501) for fewer lines and less indentation.

The fix

How does this pull request fix your problem? Did you consider any alternatives? Why is this the best solution, in your opinion?

The checklist

  • Associated issue
  • A news fragment in the news/ directory to describe this fix with the extension .bugfix.rst, .feature.rst, .behavior.rst, .doc.rst. .vendor.rst. or .trivial.rst (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

@oz123
Copy link
Contributor

oz123 commented Mar 5, 2025

@cclauss can you please add a news file?

@cclauss
Copy link
Contributor Author

cclauss commented Mar 5, 2025

What new file?

@oz123
Copy link
Contributor

oz123 commented Mar 5, 2025

What new file?

News . Sorry.

@matteius matteius merged commit a9d3a59 into pypa:main Mar 21, 2025
22 checks passed
@matteius
Copy link
Member

We can add a news fragment if needed on @cclauss 's behalf, but this is a helpful change.

@cclauss cclauss deleted the set-upper-limits-on-code-complexity branch March 21, 2025 13:28
@cclauss
Copy link
Contributor Author

cclauss commented Mar 21, 2025

This is failing on GitHub Actions.... New PR on its way to fix this.

@matteius
Copy link
Member

@cclauss I have a fix for the ruff issue in the pythonfinder PR if you could port it over to your new PR to fix ruff.

@cclauss cclauss mentioned this pull request Mar 21, 2025
2 tasks
@cclauss
Copy link
Contributor Author

cclauss commented Mar 21, 2025

You can choose to merge #6367 or your pythonfinder PR to fix the open ruff issues.

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.

3 participants