The when he says, Judge not before, he concludes the prohibition against rash judgment. In regard to this he does three things: first, he forbids them to anticipate God's judgment, saying: Therefore, in keeping with my example, who neither judge myself nor care about being judged by others, but reserve my judgment to God, do not pronounce judgment before the time, because "every matter has its time" (Ec 8:6), before the Lord comes to judge: "The Lord enters into judgment with the elders and princes of his people" (Is 3:14). Hence the Lord Himself said: "Judge not" (Matt 7:1). However, this mus...t be understood of hidden things, because God has commissioned men to judge manifest things: "Hear then and judge what is just" (Dt 1:16).
For some things are manifested not only by the evidence of the fact, being notorious, but also by confession or by the proved testimony of witnesses. But God reserves hidden things for His own judgment. But things which lie in our heart or are done in secret are hidden to ourselves. Of these it says in Ps 4 (v. 5): "The things you say in your hearts, be sorry for them upon your beds." Hence a man is as rash in judging about these matters as a delegated judge, who exceeds his mandate by judging matter not committed to him. Consequently, a judgment is rash, when a person judges about doubtful matters; but it is perverse, when he pronounces a false judgment. Now although judgment should not be made concerning persons, as when a person judges as evil a man who is good, nevertheless it is more grievous, when it is a perverse judgment about things themselves, as when a person says that virginity is evil and fornication good, against which Is (5:20) says: "Woe to you that call good evil and evil good."
Secondly, he describes the completeness of the divine judgment to come, saying: who, namely the Lord coming to judgment, will bring to light the things now hidden in darkness, i.e., will make clear and obvious the things done secretly in darkness; and will disclose the purposes of the heart, i.e., all the secrets of the heart: "He reveals deep things out of darkness, and brings up to light the shadow of death" (Jb 12:22); "I will search Jerusalem with lamps" (Zeph 1:12). This, of course, refers both to good things and to evil things that have been committed and covered over by penance, for Ps 32 (v.1): "Blessed is he whose transgressions is forgiven, whose sin is covered."
Thirdly, he mentions the fruit which good men will obtain from the divine judgment, saying: Then every man will receive his commendation from God, i.e., every man that is good. This commendation will be true, because God can neither deceive nor be deceived: "His praise is not from men but from God" (Rom 2:29); "It is not the man who commends himself that is accepted, but the man whom the Lord commends" (2 Cor 10:18).
Source: Commentary on 1 Corinthians