stop-iteration-return / R1708ΒΆ

Message emitted:

Do not raise StopIteration in generator, use return statement instead

Description:

According to PEP479, the raise of StopIteration to end the loop of a generator may lead to hard to find bugs. This PEP specify that raise StopIteration has to be replaced by a simple return statement

Created by refactoring checker