-
Notifications
You must be signed in to change notification settings - Fork 563
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
chore: use ruff (isort, pylint and pyflakes) instead of individual isort, pylint and black libraries #1043
Conversation
] | ||
"**/{test,docs}/*" = [ | ||
# https://docs.astral.sh/ruff/rules/magic-value-comparison/ | ||
"PLR2004" |
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.
This is to prevent error like below:
test/unit/webdriver/network_test.py:33:45: PLR2004 Magic value used in comparison, consider replacing `2` with a constant variable
|
31 | body='{"value": {"wifi": true, "data": false, "airplaneMode": false}}',
32 | )
33 | assert driver.network_connection == 2
| ^ PLR2004
34 |
35 | @httpretty.activate
|
Makefile
Outdated
.PHONY: mypy | ||
mypy: ## Run mypy | ||
python -m mypy appium test/functional | ||
.PHONY: ruff |
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.
maybe create two tasks: format
+ lint
for local dev and the task check
, which would be called automatically in the precommit hook
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.
the idea is that we don't want to rely on tool names, but rather intention purposes
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.
makes sense
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.
👍
#1042
Rules:
https://docs.astral.sh/ruff/rules/
Some customizations such as quote are in
.ruff.toml
. Max line length comes from current pylint rule.pyflakes is default one in ruff. I have enabled isort and pylint.
Some diffs between
black
and defaultruff
.https://docs.astral.sh/ruff/formatter/black/
I have applied:
I'm good with this PR format, but if we want to add rules, I'm happy to hear it.
cc @mykola-mokhnach if you have any preferences