nbQA-dev / nbQA

Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
https://nbqa.readthedocs.io/en/latest/index.html
MIT License
1.02k stars 39 forks source link

Support for Ruff #772

Closed marscher closed 1 year ago

marscher commented 1 year ago

Ruff is an uprising super fast Python linter written in Rust. It seems like one needs to add some tests and docs for it, since it runs out of the box.

pip install ruff
nbqa ruff /my_project/notebook_dir

output:

Found 47 error(s).
/home/marscher/sources/weldx/tutorials/01_01_introduction.ipynb:cell_2:1:1: E402 Module level import not at top of file
...

Also the fix option works, since this project is very cleverly designed!

MarcoGorelli commented 1 year ago

Thanks @marscher !

Yeah we should definitely add tested support for ruff and a nbqa-ruff hook - are you interested in contributing a pull request?