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

feat(bindings/python): add ruff as linter #4135

Merged
merged 10 commits into from
Feb 3, 2024
Merged

feat(bindings/python): add ruff as linter #4135

merged 10 commits into from
Feb 3, 2024

Conversation

asukaminato0721
Copy link
Contributor

try fix #3468

@suyanhanx suyanhanx changed the title Add ruff feat(bindings/python): add ruff as linter Feb 3, 2024
.github/workflows/bindings_python.yml Outdated Show resolved Hide resolved
.github/workflows/bindings_python.yml Outdated Show resolved Hide resolved
@Xuanwo
Copy link
Member

Xuanwo commented Feb 3, 2024

Python CI not running for:

image

Since ruff is in pyproject.toml, I guess not `pip install` here is ok
@asukaminato0721
Copy link
Contributor Author

now it break the ci, which means works :)

benchmark/async_origin_s3_benchmark_with_gevent.py:22:1: E402 Module level import not at top of file
benchmark/async_origin_s3_benchmark_with_gevent.py:26:1: E402 Module level import not at top of file
benchmark/async_origin_s3_benchmark_with_gevent.py:28:1: E402 Module level import not at top of file
benchmark/async_origin_s3_benchmark_with_gevent.py:29:1: E402 Module level import not at top of file
benchmark/async_origin_s3_benchmark_with_gevent.py:30:1: E402 Module level import not at top of file
benchmark/async_origin_s3_benchmark_with_gevent.py:31:1: E402 Module level import not at top of file
python/opendal/__init__.py:18:1: F403 `from ._opendal import *` used; unable to detect undefined names
python/opendal/__init__.py:20:11: F405 `_opendal` may be undefined, or defined from star imports
python/opendal/__init__.py:21:11: F405 `_opendal` may be undefined, or defined from star imports

I guess we could ignore these first.

@Xuanwo
Copy link
Member

Xuanwo commented Feb 3, 2024

Thanks for your effort! Now our ruff check is running.

Lint like the following could be ignored:

python/opendal/__init__.py:18:1: F403 `from ._opendal import *` used; unable to detect undefined names
python/opendal/__init__.py:20:11: F405 `_opendal` may be undefined, or defined from star imports
python/opendal/__init__.py:21:11: F405 `_opendal` may be undefined, or defined from star imports

_opendal is from our rust binding that not in current context.

And the error like

benchmark/async_origin_s3_benchmark_with_gevent.py:31:1: E402 Module level import not at top of file

Could be fixed easily.

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thanks!

@Xuanwo Xuanwo merged commit cabab15 into apache:main Feb 3, 2024
37 checks passed
@asukaminato0721 asukaminato0721 deleted the add-ruff branch February 3, 2024 18:20
@asukaminato0721
Copy link
Contributor Author

there are some more lint rules

could be done in further pr, leave a note here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

binding/python: Enable ruff for lint and format
2 participants