chore: use ruff (isort, pylint and pyflakes) instead of individual isort, pylint and black libraries#1043
Merged
chore: use ruff (isort, pylint and pyflakes) instead of individual isort, pylint and black libraries#1043
Conversation
KazuCocoa
commented
Oct 9, 2024
| ] | ||
| "**/{test,docs}/*" = [ | ||
| # https://docs.astral.sh/ruff/rules/magic-value-comparison/ | ||
| "PLR2004" |
Member
Author
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
maybe create two tasks: format + lint for local dev and the task check, which would be called automatically in the precommit hook
Contributor
There was a problem hiding this comment.
the idea is that we don't want to rely on tool names, but rather intention purposes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#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
blackand 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