scientific-python / repo-review

Framework that can run checks on repos
https://repo-review.readthedocs.io
BSD 3-Clause "New" or "Revised" License
62 stars 3 forks source link

VPP001: Error: `tool.ruff.lint` cannot be validated by any definition #232

Closed DimitriPapadopoulos closed 1 month ago

DimitriPapadopoulos commented 1 month ago

See: https://learn.scientific-python.org/development/guides/repo-review/?repo=pypa%2Fsetuptools_scm&branch=main

The error message is unclear, I think the failure originates here:

[tool.ruff.lint.isort]
force-single-line = true
from-first = false
lines-between-types = 1
order-by-type = true
henryiii commented 1 month ago

Are one of those fairly new? We might need ti bum validate-pyproject-schema-store. Or the SchemaStore might need a new update (which the stuff team does pretty regularly).

DimitriPapadopoulos commented 1 month ago

None of these settings is very recent, the most recent is from-first from 2023 (https://github.com/astral-sh/ruff/pull/8663).

In the error message, the isort key is almost empty:

    'isort':
      at least one of the following:
        - {}
        - {type: null}

Is that expected?

henryiii commented 1 month ago

Hard to check on my phone, is it in here: https://json.schemastore.org/ruff.json

DimitriPapadopoulos commented 1 month ago

It points to the IsortOptions definitions:

Screen Capture

henryiii commented 1 month ago

It's mad about

lint.select = ["E", "F", "B", "U", "YTT", "C", "DTZ", "PYI", "PT", "I", "FURB", "RUF"]

I think because it has preview only selections in it.

henryiii commented 1 month ago

The issue is "U" is not a valid code. "UP" is the correct code. See https://github.com/pypa/setuptools_scm/pull/1064.

DimitriPapadopoulos commented 1 month ago

What got me confused is that there were 2 error messages for the same issue;

The error message could be more helpful (perhaps show the actual invalid code).

henryiii commented 1 month ago

For validation, that's handled by validate-pyproject, maybe the error message can be improved there (it's from fastjsonshema). For our end (sp-repo-review, that is), RF103: pyupgrade must be selected. Must select the pyupgrade UP checks. described exactly what was missing (no UP code).

DimitriPapadopoulos commented 1 month ago

Because RF103 had already been raised about the UP typo, I was misled into looking elsewhere for the VPP001 cause.

The same root cause should not result into different error messages, especially without enough details to clearly identify the root cause (at least a line number).