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

introduce Ruff as linter #345

Merged
merged 6 commits into from
Jan 23, 2024
Merged

introduce Ruff as linter #345

merged 6 commits into from
Jan 23, 2024

Conversation

hirosassa
Copy link
Collaborator

@hirosassa hirosassa commented Jan 21, 2024

What I did in this PR

related to #344

I introduce ruff as linter.
I replaced flake8 and isort to simplify the configuration.

What I did not do

Replacing yapf with ruff is next task.

ignore = "B006,B008,W503"
max-line-length = 160
exclude = "venv/*,tox/*"
ignore = ["B006", "B008"]
Copy link
Collaborator Author

@hirosassa hirosassa Jan 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W503 is not currently supported in ruff and it will not be implemented.
ref: astral-sh/ruff#4125

Is anyone who want to ignore this error?

@@ -1,4 +1,4 @@
import random
import random # noqa: I001
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This noqa is needed for line 8.
If I remove this noqa the line will fixed as following format by ruff

from gokart.redis_lock import (
    RedisClient,
    RedisParams,
    make_redis_key,
    make_redis_params,
    wrap_with_dump_lock,
    wrap_with_load_lock,
    wrap_with_remove_lock,
    wrap_with_run_lock,
)

To minimize diff in this PR I added it but it needs to discuss with this issue.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[imo] +1 to ruff's one, and +10 to accept default behaviors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied! e834ad0

@yokomotod
Copy link
Collaborator

@hirosassa Great! Can you compare exection time?

Copy link
Member

@kitagry kitagry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

poetry.lock Outdated Show resolved Hide resolved
@hirosassa
Copy link
Collaborator Author

hirosassa commented Jan 21, 2024

@yokomotod In my local PC, using tox command, it shows about 46 times faster!! ⚡️

# ruff
ruff: OK (0.06=setup[0.01]+cmd[0.06] seconds)

# flake8 + isort
isort: OK (1.06=setup[0.32]+cmd[0.74] seconds)
flake8: OK (2.16=setup[0.22]+cmd[1.94] seconds)

tox.ini Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@hirosassa
Copy link
Collaborator Author

@yokomotod All of your suggestions are fixed! plz check.

Copy link
Collaborator

@yokomotod yokomotod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hirosassa hirosassa merged commit e1430ee into m3dev:master Jan 23, 2024
5 checks passed
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