Add unknown-rule (#15085)

Co-authored-by: Carl Meyer <carl@astral.sh>
This commit is contained in:
Micha Reiser 2024-12-23 11:30:54 +01:00 committed by GitHub
parent 68ada05b00
commit 2835d94ec5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 215 additions and 73 deletions

View file

@ -84,11 +84,10 @@ def test( # knot: ignore
## Can't suppress `revealed-type` diagnostics
TODO: Emit an error that the rule code is unknown: `unknown-rule`
```py
a = 10
# revealed: Literal[10]
# error: [unknown-rule] "Unknown rule `revealed-type`"
reveal_type(a) # knot: ignore[revealed-type]
```
@ -164,3 +163,10 @@ severity: `knot: possibly-undefined-reference=error`
a = 4 / 0 # error: [division-by-zero]
```
## Unknown rule
```py
# error: [unknown-rule] "Unknown rule `is-equal-14`"
a = 10 + 4 # knot: ignore[is-equal-14]
```