ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Support for PEP 639 in RUF200

Open henryiii opened this issue 1 year ago • 2 comments

In --preview, the following error is shown for PEP 639 style licenses:

tests/packages/spdx/pyproject.toml:5:17: RUF200 Failed to parse pyproject.toml: wanted string or table
  |
3 | version = "1.2.3"
4 | license = "MIT OR GPL-2.0-or-later OR (FSFUL AND BSD-2-Clause)"
5 | license-files = ["LICEN[CS]E*", "AUTHORS*", "licenses/LICENSE.MIT"]
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF200

I don't fully understand the error message (license-files was never a string or table), but it would be good to support PEP 639, ~~at least before this leaves preview~~ (Edit: Ahh, this happens if you run ruff check . even without --preview, I always use pre-commit except for checking --preview).

henryiii avatar Oct 21 '24 20:10 henryiii

Agree, we should change the validation here.

@konstin do you know why we flag license-files if it isn't a table?

MichaReiser avatar Oct 22 '24 06:10 MichaReiser

The pyproject-toml crate has an outdated version of the PEP, we need to fix this in that crate which will fix the rule.

konstin avatar Oct 22 '24 07:10 konstin

This has been merged into the ruff-0.8 branch; it will land in the next release (Ruff 0.8)

AlexWaygood avatar Nov 18 '24 17:11 AlexWaygood