Raised exceptions not detected in "else" or "finally" blocks after darglint 1.2.0
Here is the sample code and darglint==1.2.0 can detect missing raises doc strings for both errors in else and finally blocks. After upgrading to latest darglint==1.5.4, these missing exception doc errors are not reported.
Is this expected in newer version to skip checking raise in such else and finally blocks? Thank you.
# sample.py
def func() -> None:
"""Test."""
try:
1 // 0
except Exception:
pass
else:
raise ValueError('error in except')
finally:
raise RuntimeError('error in finally')
# darglint 1.2.0
darglint sample.py
sample.py:func:1: DAR401: -r RuntimeError
sample.py:func:1: DAR401: -r ValueError
# darglint 1.5.4
darglint sample.py
# empty - no error reported
I don't think darglint ever handled them explicitly -- it was kind of an accidental catch. I think this should be pretty easy to handle, though, so we should cover it. Thanks for pointing it out!
Fixed in 62802244d2d390fec9099b822639761c2efe6b60. Should be present in 1.5.5, when that's released.
@terrencepreilly I believe this issue can be closed since you released 1.5.5 in the mean time :).