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

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

Open
apyrgio opened this issue Nov 18, 2022 · 7 comments · May be fixed by #1019
Open

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

apyrgio opened this issue Nov 18, 2022 · 7 comments · May be fixed by #1019
Labels
good first issue Good for newcomers
Milestone

Comments

@apyrgio
Copy link
Contributor

apyrgio commented Nov 18, 2022

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
Copy link
Contributor Author

apyrgio commented Nov 18, 2022

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

  1. For Black, see Should black remove unused imports? psf/black#86.
  2. For isort, see Delete unused imports PyCQA/isort#1105
  3. For mypy, see Figure out how to detect unused imports python/mypy#865

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

@legoktm
Copy link
Member

legoktm commented Feb 15, 2023

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

@deeplow
Copy link
Contributor

deeplow commented Feb 16, 2023

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

almet added a commit to almet/dangerzone that referenced this issue May 22, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to freedomofpress#254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit to almet/dangerzone that referenced this issue May 23, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to freedomofpress#254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit to almet/dangerzone that referenced this issue May 27, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to freedomofpress#254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit that referenced this issue Jun 4, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to #254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit that referenced this issue Jun 4, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to #254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit that referenced this issue Jun 5, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to #254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit that referenced this issue Jun 5, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to #254, although it doesn't provide the command to lint the
codebase itself.
almet added a commit to almet/dangerzone that referenced this issue Jun 5, 2024
As detected by [ruff](https://github.com/astral-sh/ruff)

Related to freedomofpress#254, although it doesn't provide the command to lint the
codebase itself.
@almet
Copy link
Contributor

almet commented Oct 14, 2024

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/.

@eloquence eloquence changed the title Lint the codebase against unused imports Use ruff for linting, code formatting and module sorting Oct 31, 2024
@eloquence eloquence added this to the 0.9.0 milestone Oct 31, 2024
@jkarasti
Copy link
Contributor

jkarasti commented Nov 7, 2024

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
Copy link
Contributor

almet commented Nov 9, 2024

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 👍

@apyrgio apyrgio added the good first issue Good for newcomers label Dec 2, 2024
@jkarasti jkarasti linked a pull request Dec 2, 2024 that will close this issue
@jkarasti
Copy link
Contributor

jkarasti commented Dec 2, 2024

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

@apyrgio apyrgio moved this from Todo to PR Review in Dangerzone ✨ Dec 5, 2024
@apyrgio apyrgio removed the status in Dangerzone ✨ Dec 5, 2024
@apyrgio apyrgio moved this to PR Review in Dangerzone ✨ Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: PR Review
Development

Successfully merging a pull request may close this issue.

6 participants