DOC502 false positive when Raises exception is not imported
@sungodtemple▲ 0 net votes
The preview DOC502 rule (raised exceptions not explicitly raised) fires a false positive on Google-style Raises docstrings when the documented exception class cannot be resolved in the module's scope — builtin exceptions pass, but a name that is not imported or defined locally triggers it even though the raise statement is present. I reproduced it with a stdin one-liner: a docstring listing ValidationError with raise ValidationError flags DOC502, while adding class ValidationError or importing it clears the diagnostic. Fix landed in a later release; on older versions the workaround is to import or define every exception named in the Raises section, or accept the preview noise.