mirror of https://github.com/astral-sh/ruff
Except BaseException from N818 checks (#798)
This commit is contained in:
parent
ab825eb28d
commit
801c76037f
|
|
@ -10,5 +10,9 @@ class C(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class D(AnotherError):
|
class D(BaseException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class E(AnotherError):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ pub fn error_suffix_on_exception_name(
|
||||||
) -> Option<Check> {
|
) -> Option<Check> {
|
||||||
if bases.iter().any(|base| {
|
if bases.iter().any(|base| {
|
||||||
if let ExprKind::Name { id, .. } = &base.node {
|
if let ExprKind::Name { id, .. } = &base.node {
|
||||||
id.ends_with("Exception") || id.ends_with("Error")
|
id == "Exception" || id.ends_with("Error")
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@ expression: checks
|
||||||
column: 0
|
column: 0
|
||||||
fix: ~
|
fix: ~
|
||||||
- kind:
|
- kind:
|
||||||
ErrorSuffixOnExceptionName: D
|
ErrorSuffixOnExceptionName: E
|
||||||
location:
|
location:
|
||||||
row: 13
|
row: 17
|
||||||
column: 0
|
column: 0
|
||||||
end_location:
|
end_location:
|
||||||
row: 15
|
row: 19
|
||||||
column: 0
|
column: 0
|
||||||
fix: ~
|
fix: ~
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue