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

[dev] Lint with ruff #27

Closed
real-yfprojects opened this issue Jun 8, 2023 · 5 comments
Closed

[dev] Lint with ruff #27

real-yfprojects opened this issue Jun 8, 2023 · 5 comments

Comments

@real-yfprojects
Copy link
Contributor

I would like to configure ruff as a linter for the our python code. It is very fast and supports all rules known from flake8, pylint,...

@jsh9
Copy link
Owner

jsh9 commented Jun 9, 2023

I'm using quite a few flake8 plugins in this repo, such as these.

I'm not sure ruff has implemented all of these.

pydoclint is a small repo (and I don't think it will become very big eventually), so at least right now, I'm not seeing the linter running time as a bottleneck or an inconvenience.

@real-yfprojects
Copy link
Contributor Author

I'm not sure ruff has implemented all of these.

I'll check.

pydoclint is a small repo (and I don't think it will become very big eventually), so at least right now, I'm not seeing the linter running time as a bottleneck or an inconvenience.

I agree.

@real-yfprojects
Copy link
Contributor Author

I'm not sure ruff has implemented all of these.

I'll check.

Many are but not all.

@real-yfprojects real-yfprojects closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2023
@ssbarnea
Copy link

ssbarnea commented Jun 26, 2024

@jsh9 Can we have an updated list of rules that are already covered by ruff? I would find very useful to only run ruff and avoid ruinning flake8 with pydoclint or pydoclint separately, especialy as separated it lacks a huge number of important features, like inline noqa.

There are other implications, like lack of a vscode extension, which makes it even more painful.

Out of curiosity, have you considered trying to implement the missing ones in ruff itself, so we would not need pydoclint anymore? -- I know that writing rust code is not as easy or fun as python, but on the long run, it would translate to far less maintenance, as ruff is under heavy development.

PS. I asked about a plugin system for ruff at astral-sh/ruff#283 (comment) but I doubt that will happen too soon if ever. Probably would be much easier reimplement the rules.

@jsh9
Copy link
Owner

jsh9 commented Jun 26, 2024

Hi @ssbarnea ,

My goal is to make pydoclint as good as I can, and integrating with Ruff is out of the scope of this project.

I believe it is Ruff's authors' responsibility (rather than ours) to find good Python linters and translate them into Rust. Additionally many authors of these linters (such as myself) don't code in Rust, so we can't really contribute to Ruff.

And honestly, I doubt that Ruff will be sustainable in the long run. Here are some of my reasons:

  1. It is too centralized so it can't move fast enough. (For example, it seems Ruff's authors may still consider translating darglint.)
  2. The speed benefit it offers do not benefit small repos (such as pydoclint): do you really care about saving a few seconds if your repo is small?
  3. Ruff's coverage is far from comprehensive. One example is: I use a lot of flake8 plugins that are not implemented in Ruff:

    pydoclint/tox.ini

    Lines 40 to 57 in bf674fa

    [testenv:flake8-misc]
    skip_install = true
    deps =
    flake8-bugbear
    flake8-comprehensions
    flake8-eradicate
    flake8-broken-line
    flake8-quotes
    flake8-debugger
    flake8-length
    flake8-clean-block
    flake8-indent-in-def
    flake8-picky-parentheses
    flake8-implicit-str-concat
    flake8-return
    flake8-broken-line
    commands =
    flake8 --select B,C,D,E800,N4,Q,T,LN,CLB,IND,PAR,ISC,R,N400 .

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

3 participants