terrencepreilly / darglint

A python documentation linter which checks that the docstring description matches the definition.
MIT License
481 stars 41 forks source link

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

Open PhilMacKay opened 2 years ago

PhilMacKay commented 2 years ago

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.

terrencepreilly commented 2 years ago

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