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

Ruff set python version and enable more rules #2551

Merged

Conversation

tdadela
Copy link
Contributor

@tdadela tdadela commented Jan 14, 2024

  1. Set python target-version for ruff.
  2. Enable FA102 rule (Checks for uses of PEP 585- and PEP 604-style type annotations in Python modules that lack the required from future import annotations import for compatibility with older Python versions).
  3. Enable pyupgrade rules.
  4. Make code compatible with rules.

locust/user/task.py Outdated Show resolved Hide resolved
@cyberw
Copy link
Collaborator

cyberw commented Jan 14, 2024

Nice! One small comment, then it is good to go.

@tdadela
Copy link
Contributor Author

tdadela commented Jan 15, 2024

What do you think about also enabling isort-like "unsorted-imports (I001)" rule?
(https://docs.astral.sh/ruff/rules/unsorted-imports/)

@cyberw cyberw merged commit 4e60b41 into locustio:master Jan 15, 2024
11 checks passed
@tdadela tdadela deleted the ruff_set_python_version_add_linting_rules branch January 15, 2024 21:06
@cyberw
Copy link
Collaborator

cyberw commented Jan 15, 2024

What do you think about also enabling isort-like "unsorted-imports (I001)" rule? (https://docs.astral.sh/ruff/rules/unsorted-imports/)

Sounds good! I tried using isort a little, but in some cases (locustfiles) we need to ensure locust is imported before other things (because of gevent monkeypatching). If that can be solved then great!

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