freedomofpress / dangerzone

Take potentially dangerous PDFs, office documents, or images and convert them to safe PDFs
https://dangerzone.rocks/
GNU Affero General Public License v3.0
3.76k stars 171 forks source link

Use `ruff` for linting, code formatting and module sorting #254

Open apyrgio opened 2 years ago

apyrgio commented 2 years ago

The codebase has several unused imports, that a linter could warn against. Find a linter for this job and use it as part of our make lint action.

apyrgio commented 2 years ago

Our make lint command currently employs three linters, none of which has an option to warn on unused imports:

  1. For Black, see https://github.com/psf/black/issues/86.
  2. For isort, see https://github.com/PyCQA/isort/issues/1105
  3. For mypy, see https://github.com/python/mypy/issues/865

The rationale is that the are other tools for this job, such as pylint, flake8, and autoflake.

legoktm commented 1 year ago

flake8 is typically used for this purpose, I would recommend it in general as a pretty fast general purpose linter.

deeplow commented 1 year ago

I have done this in the past in Dangerzone. But I don't recall what I used.

almet commented 1 month ago

Generally speaking, ruff seems the goto project for linting and formatting these days, and it's providing hints for this: https://docs.astral.sh/ruff/rules/unused-import/.

jkarasti commented 3 weeks ago

I'd like to work on this. I've been planning on opening a PR for a while now actually, but I've mostly focused on wrangling the Dangerzone Windows installer and WiX Toolset. But maybe as a fun weekend project...

almet commented 3 weeks ago

I'd like to work on this. I've been planning on opening a PR for a while now actually, but I've mostly focused on wrangling the Dangerzone Windows installer and WiX Toolset. But maybe as a fun weekend project...

Great, don't hesitate to do it and let us know, it'll be a welcome addition 👍

jkarasti commented 2 days ago

I'd like to work on this. I've been planning on opening a PR for a while now actually, but I've mostly focused on wrangling the Dangerzone Windows installer and WiX Toolset. But maybe as a fun weekend project...

Great, don't hesitate to do it and let us know, it'll be a welcome addition 👍

Finally got around to opening the PR see #1019