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

Add the ruff linter #424

Merged
merged 4 commits into from
May 6, 2024
Merged

Add the ruff linter #424

merged 4 commits into from
May 6, 2024

Conversation

jherland
Copy link
Member

A minimal introduction of ruff. The first in a series of 3 PRs.

Commits:

  • Mypy: Disallow blanket type: ignore
  • pyproject.toml: Add ruff as a lint dependency
  • Add minimal ruff configuration
  • noxfile.py: Add ruff check . to lint target

@jherland jherland requested review from mknorps and zz1874 April 16, 2024 07:29
@jherland jherland self-assigned this Apr 19, 2024
Copy link
Collaborator

@mknorps mknorps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for introducing ruff to FawltyDeps. The developer's experience will improve a lot (and CI will be happier as well ;) )

I have one question about the ruff settings, namely:

target-version = "py37"

It is not ideal that we have to define lower boundary version in two places (second being):

[tool.poetry.dependencies]
...
python = ">=3.7.2"

I looked into target-version option documentation, and I see that it would have been read by default, but from:

[project]
requires-python = ">=3.8"

Is this a poetry-focused usage of pyproject.toml which disallows that?

Apart from this question, I have no other comments.
All is clear, works well, and is documented 🚀

@jherland
Copy link
Member Author

jherland commented May 6, 2024

Is this a poetry-focused usage of pyproject.toml which disallows that?

Exactly. Since we're using Poetry, we're currently defining our project metadata in the Poetry-specific [tool.poetry] section in our pyproject.toml.

[project]
requires-python = ">=3.8"

This is from the PEP621 standard for specifying project metadata, and this standard seems to have more momentum than Poetry's own format, so I'd like to migrate to this at some point. Either we see if Poetry can support the more standard format, or we look around for alternatives to Poetry. But that is a separate issue/effort than this PR. 😄

A specific Mypy rule must accompany any 'type: ignore' directive.
For now, run it with `ruff check .` - we will soon replace `pylint` with
`ruff` in the `lint` Nox target.
This configures ruff so that the default set of checks pass on the
current state of our project. A couple of ignores are needed, along
with excluding one file which is in a non-UTF8 charset.
Don't replace pylint just yet...
@jherland jherland merged commit bd364b2 into main May 6, 2024
63 checks passed
@jherland jherland deleted the jherland/add-ruff branch May 6, 2024 12:36
@jherland
Copy link
Member Author

jherland commented May 7, 2024

Either we see if Poetry can support the more standard format, or we look around for alternatives to Poetry. But that is a separate issue/effort than this PR.

Created #433 to keep discussing our future with/without Poetry

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

Successfully merging this pull request may close these issues.

None yet

2 participants