I've added a new rule to flake8-bugbear.
In brief, the rule detects bugs like the following:
some_list = [1,2,3]
for i in some_list:
if i % 2 == 0:
some_list.remove(i)
print(i)
(More context at github.com/PyCQA/flake8-bugbear/issues/445)
I'd be happy to contribute if its desired to implement this rule in ruff as well 🙂