mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-52477 PY-78913 Add inspection for inconsistent returns
Merge-request: IJ-MR-154297 Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com> GitOrigin-RevId: e89225212cc981a5b256fca4ee23d77659b3ce5e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6c8675e758
commit
e8f5b1c631
+11
-3
@@ -1,7 +1,15 @@
|
||||
def f(x) -> int | None:
|
||||
if x == 1:
|
||||
y = 42
|
||||
print(y)
|
||||
<weak_warning descr="Explicit return statement expected">if x == 1:
|
||||
return 42
|
||||
elif x == 2:
|
||||
<warning descr="Function returning 'int | None' has implicit 'return None'">return<caret></warning>
|
||||
<weak_warning descr="Explicit return value expected">return<caret></weak_warning>
|
||||
elif x == 3:
|
||||
pass
|
||||
raise Exception()
|
||||
elif x == 4:
|
||||
assert False
|
||||
elif x == 5:
|
||||
<weak_warning descr="Explicit return statement expected">assert x</weak_warning>
|
||||
elif x == 4:
|
||||
<weak_warning descr="Explicit return statement expected">pass</weak_warning></weak_warning>
|
||||
+9
@@ -1,8 +1,17 @@
|
||||
def f(x) -> int | None:
|
||||
y = 42
|
||||
print(y)
|
||||
if x == 1:
|
||||
return 42
|
||||
elif x == 2:
|
||||
return None
|
||||
elif x == 3:
|
||||
raise Exception()
|
||||
elif x == 4:
|
||||
assert False
|
||||
elif x == 5:
|
||||
assert x
|
||||
return None
|
||||
elif x == 4:
|
||||
return None
|
||||
return None
|
||||
Reference in New Issue
Block a user