Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
Python lint: Ruff rules for pylint and code complexity#525
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -102,18 +102,36 @@ executionEnvironments = [ | ||
| { root = "examples/servers", reportUnusedFunction = false }, | ||
| ] | ||
| [tool.ruff.lint] | ||
| select = ["C4", "E", "F", "I", "PERF", "UP"] | ||
| ignore = ["PERF203"] | ||
| [tool.ruff] | ||
| line-length = 120 | ||
| target-version = "py310" | ||
| extend-exclude = ["README.md"] | ||
| [tool.ruff.lint] | ||
| select = [ | ||
| "C4", # flake8-comprehensions | ||
| "C90", # mccabe | ||
| "E", # pycodestyle | ||
| "F", # pyflakes | ||
| "I", # isort | ||
| "PERF", # Perflint | ||
| "PL", # Pylint | ||
| "UP", # pyupgrade | ||
| ] | ||
| ignore = ["PERF203", "PLC0415", "PLR0402"] | ||
| mccabe.max-complexity = 24 # Default is 10 | ||
| [tool.ruff.lint.per-file-ignores] | ||
| "__init__.py" = ["F401"] | ||
| "tests/server/fastmcp/test_func_metadata.py" = ["E501"] | ||
| "tests/shared/test_progress_notifications.py" = ["PLW0603"] | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not my favorite solution, but assuming the same thing applies as above - we have this code already, we were just ignoring it by omission. | ||
| [tool.ruff.lint.pylint] | ||
| allow-magic-value-types = ["bytes", "float", "int", "str"] | ||
| max-args = 23 # Default is 5 | ||
| max-branches = 23 # Default is 12 | ||
| max-returns = 13 # Default is 6 | ||
| max-statements = 102 # Default is 50 | ||
| [tool.uv.workspace] | ||
| members = ["examples/servers/*", "examples/snippets"] | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"PLC0415" and "PLR0402" are newly added.
I'm assuming that's because we've added to the selection of tools above causing new lint errors to appear that we previously were ignoring by omission?
If so I'm OK with this trade-off in the short term to have a bit more manageable complexity.