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

Run ruff and fix issues? #410

Open
DimitriPapadopoulos opened this issue Mar 9, 2023 · 2 comments
Open

Run ruff and fix issues? #410

DimitriPapadopoulos opened this issue Mar 9, 2023 · 2 comments

Comments

@DimitriPapadopoulos
Copy link
Contributor

Would you be willing to fix issues reported by ruff?

$ ruff --ignore 'E501,F405,F403' .
docs/conf.py:14:1: E401 Multiple imports on one line
docs/conf.py:14:8: F401 [*] `sys` imported but unused
docs/conf.py:14:13: F401 [*] `os` imported but unused
stdnum/ec/ci.py:50:5: E731 [*] Do not assign a `lambda` expression, use a `def`
stdnum/nz/bankaccount.py:94:42: E741 Ambiguous variable name: `l`
stdnum/pt/cc.py:64:5: E731 [*] Do not assign a `lambda` expression, use a `def`
Found 6 errors.
[*] 4 potentially fixable with the --fix option.
$ 

From a pitch seen elsewhere: "Ruff supports over 500 lint rules including bandit, isort, pylint, pyupgrade, and flake8 plus its plugins and is written in Rust for speed".

I could start by fixing these issues, and then maybe attempt to move CI tests to ruff instead of flake8.

@arthurdejong
Copy link
Owner

I've had a quick look a while back and here are some random thoughts.

  • I'm not that happy with the recent changes in flake8 (breaking existing configuration and refusing discussion about it) so I'm open to alternatives
  • I find it a bit weird that ruff is written in Rust: it says that you can't or shouldn't implement Python linting tools in Python 😕
  • the primary advertised selling point of ruff is the speed improvement but I've never considered flake8 to be slow (pylint yes but flake8 no)
  • it does not support Python 2.7 code without a lot of tweaking
  • I like the fix ability (but by default it makes changes that means that my code no longer works with older Python versions)
  • I really like the concept of flake8 to have plugins that can easily extend the checks that are done and the freedom of choice it brings
  • I have some concerns regarding the stability of ruff given the large number of releases (currently version 0.0.272)

I'll probably look into this more sometime soon and see if I can integrate some of the improvements suggested by ruff.

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Jun 18, 2023

The only stability issue is that ruff breaks CI from time to time because of new rules, unless of course you pin it down to a very specific version. The core program is stable in my short experience, but the ever increasing set of rules is a pain.

I must admit, I hadn't thought about Python 2.7.

Finally, don't see Rust as a problem, as installation involves a mere pip install ruff.

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

No branches or pull requests

2 participants