The CCC summarises what Christ commanded:
“Stop judging by appearances, but judge justly.” (Jn 7:24).
“Beware of false prophets, who come to you in sheep’s clothing, but underneath are ravenous wolves. By their fruits you will know them” (Mt 7:15, 16).
“Every tree that does not bear good fruit will be cut down and thrown into the fire. So by their fruits you will know them.” (Mt 7:19-20).
And St Paul, following the Master:
“Test everything: retain what is good.” (1Thess 5:21).
“The spiritual person, however, can judge everything but is not subject to judgment by anyone.” (1 Cor 2:15).
That is precisely why we judge actions, speech, writing against true teaching as to what is good and what is evil, and we know what is good and what is evil only by following the teaching of His Church – not by our opinions, desires, prejudices, feelings, wants – selfism.
We are commanded not to judge the guilt of anyone before God.