Hafetz Haim Halachot
Halacha 75 / 215

Hilchos Lashon Hara chapter 4, section 7

The duty to judge favorably is only for a person who usually regrets their sins.

But if a person has checked and sees that this one has no fear of G-d – for example, someone who throws off the yoke of Heaven, or who is not careful about a certain sin that everyone knows is a sin – then it is allowed to tell about their bad deeds and shame them, both to their face and behind their back.

And if they do something that can be understood in a good way or a bad way, one should judge it as bad, since they are known to be completely wicked in other things.

Our Sages said: "Do not wrong one another" (lo tonu) – this means "your fellow," one who is with you in Torah and mitzvot. But a wicked person may be shamed for their deeds, and scorn may be poured on them.