Focusing and seeing and obsessing on others' bad qualities will eventually cause us to take on those qualities ourselves. Why? If we can gain the Buddha's qualities by meditating and contemplating on them, we can also gain the negative qualities of other people when we focus and meditate on them. It only makes sense that the meditation will work the other way round. So why waste our mental power focusing and acquiring the negative qualities of others when we can acquire the positive ones? It only makes more sense that we dont and we focus only on the good qualities on others. Also, on top of that, nobody wants to be criticized or judged for their actions, yet in their delusions, they judge and criticize others, creating the cause for them to be criticized and judged in the end. If we are okay with being criticized and judged, then we can criticize and judge others. If we find tremendous suffering when we are being criticized or judged, then we should not criticize or judge others, nor should we keep a negative impression of others in our minds as it will also cause us to hold on to the negative qualities of others and in the end we cannot even form a good connection with them. What if they change for the better and our impressions did not change? Then it is a case of accusing others.
With that said, sometimes it is also important to learn from the mistake of others so that we do not repeat them. There is a difference between badmouthing and relating a story so that others may learn. There is a difference between focusing on the bad qualities of others and reveling in it and feeling more superior as a result, and discussing about the negative qualities so that we can learn not to repeat the same mistake. Often people make the mistake of either talking too much about the negative qualities of a person, or not talking about it at all. Both also have the same results, that is the mistake or negative quality will be repeated and inherited by the said persons, or by people who have not heard of that story before. If talking about the mistakes of others is bad, then in many sutras and commentaries, the stories of how the buddhist sages of the past 'screw up' (for example, Rechungpa's mistake of defying milarepa several times, or how naropa broke his Guru's instruction to not engage in debate, or how marpa missed out on Vajrayogini because he prostrated to the Yidam and not the Guru) would be covered up. The fact that they are published means we must learn from them, so that we do not do what they did.
In the end, we need to be very careful of our motivation and thoughts when contemplating of others' mistakes. We must not repeat them and we must also think of a solution on how to solve them at the same time it it repeats. It is all the training of the mind.