Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

DAR202, 302, and 402: Excess Return/Yield/Exception in protocol method #178

Open
PhilMacKay opened this issue Oct 13, 2021 · 1 comment
Open

Comments

@PhilMacKay
Copy link

PhilMacKay commented Oct 13, 2021

I'm opening a new issue specifically for Protocols. A similar issue was made for abstract method, see #54, and has been fixed (though it's still open).

A similar situation occurs when subclassing typing.Protocol. Typically, the method body of a protocol will be empty (or ...). Our team likes to document protocol methods since there are usually more references to protocols than to actual concrete classes in our code.
This leads to a lot of false positives on DAR202 (Excess Returns), DAR302 (Excess Yield), and DAR402 (Excess exception) on these methods.

I expect the fix would be similar to the one applied to abstract methods from #54.
I haven't yet looked at the code, but I may be able to create a PR myself if it's not too complex ;)

Edit: it also affects yield.

@PhilMacKay PhilMacKay changed the title DAR202 and DAR402: No return or raise statement in protocol method DAR202, 302, and 402: Excess Return/Yield/Exception in protocol method Oct 14, 2021
@terrencepreilly
Copy link
Owner

Sure, that seems reasonable. If you'd like to submit a PR, I'll take a look.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants