Moreover if your brother sins against you, go and tell him his fault between him and you alone. If he hears you, you have gained your brother.
But if he will not hear, take with you one or two more, that by the mouth of two or three witnesses every word may be established.
And if he refuses to hear them, tell it to the church. But if he refuses to hear the church, let him be to you like a heathen or a tax collector.*
I have lost count of how many times, when someone is promoting false teaching [or merely errant teaching] in a public forum, and gets publicly called out for their error, the knee-jerk response is to trot out this passage with the clichéd response, “You are supposed to go to them privately—you are violating the teachings of Jesus.”
These same people also drag out Matthew 7:1-5 and misapply it with the nonsensical idea that one must be living a life of sinless perfection before he or she is qualified to correct or rebuke those sinning or in error.
To make their blundering misuse of Scripture even worse, they tie this to an unScriptural view of Jesus—a Jesus who, according to them, never expressed anger or judged sin.
To clarify matters, let’s tackle the last issue first. Did Jesus ever display anger? Even a cursory reading of the Gospels shows that the answer to that question is a definite “YES!”
At the very beginning of His earthly ministry, He had to cleanse the temple [John 2:13-25]. In verse 17, His actions were said to be motivated by “zeal.” The Greek word is zēlos [pronounced “DZAY-los”], and it suggests that one’s actions have been provoked to the point of anger. 
Do these people really believe that Christ was devoid of any emotion when He referred to the Pharisees as a “brood of vipers?” [Matthew 12:17; 23:33]
Do they really believe Jesus showed no anger when He had to cleanse the Temple a second time? [Matthew 21:12-13]
In one passage, we note that the Gospels specifically describe Jesus’ response to the hardness of the Pharisees as “anger.” [Mark 3:5] The Greek term is orge [pronounced “or-GAY”] and it denotes the wrath of one who is entitled and empowered to seek vengeance on wrongdoers.
So it is a fallacy to assert that Jesus never experienced or displayed anger.
It is also a fallacy to assert that believers are NEVER to judge others. The command in Matthew 7:1 is NOT an absolute decree. It is conditional—something which tends to be lost in translation.
In Greek, the text reads Mē krinĕtĕ hina mē krithĕtē. Translated, it states, “[if] you [plural] do not condemn others, then you [plural] will not be condemned.”
The grammatical structure is called a purpose clause—and that purpose is not to prevent or prohibit followers of Christ from making moral distinctions, but, as verse 2 makes clear, to caution them about the standard being used for making those moral distinctions. Verses 3 through five also make the condition that we must be in a position where we cannot be accused of hypocrisy. Now the passage is not demanding sinless perfection, as some would claim, but as the apostle Paul makes clear in Romans 2:1-24, it does require that those who render moral judgments must not be guilty of the same sins they condemn.
But we cannot take the Matthew passage alone as Jesus’ final and only statement or teaching on the matter.
In the same context as He stated, If you do not condemn, then you will not be condemned, He then went on to command His followers: Beware of false prophets, who come to you in sheep’s clothing, but inwardly they are ravenous wolves. [Matthew 7:15] This raises the following question—how does one recognize false prophets [and teachers] as such without first making a judgment about them and their teachings?
Jesus also commanded, Do not judge [mē krïnĕté] according to appearance, but judge with righteous judgment. [John 7:24] So this passage provides two criteria, one positive and one negative. The negative is that we are not to judge according to appearances. The positive is that we are to judge righteously.
We have to bear in mind that when Jesus is speaking in both the context of Matthew 7 and the context of John 7, He is addressing groups which included a large number of Pharisees. As most Bible students know, the Pharisees were infamous for adding their traditions to the law of Moses and then judging people according to their own man-made traditions. They judged based on appearances only, rather than seeking to judge righteously. 
Finally, we come to the issue of private correction versus public correction. More often than not, those who make Matthew 7:1 a blanket prohibition against Christians exercising any discernment, also make Matthew 18:15-17 a blanket prohibition against all attempts at public correction.
But the questions we need to ask are: (1) Is what they claim the text means really what the text says? (2) Did Jesus intend for this to be a blanket command for dealing with EVERY sin—private or public?
When we carefully examine the text of Scripture, we see that Matthew 18:15-17 only deals with PRIVATE sin. Note the condition stated in verse 15: If your [singular] brother [singular] sins against you [singular]…. So clearly Christ is not speaking about situations where a supposed believer publicly proclaims false teaching or publicly engages in other types of sinful behaviors.
Scripture also requires that public sin merits public correction and rebuke, as we shall demonstrate.
SITUATION #1—Romans 16:17-18
Paul, writing under the superintendence of the Holy Spirit, commanded the church in Rome to “note” false teachers and to avoid [shun] them. The Greek word is skopéō, and indicates making a public indictment against false teachers.  Public sin requires public correction.
SITUATION #2—Galatians 2:11-21
Again, Paul writes under the prompting and superintendence of the Holy Spirit, recounting an instance in which the apostle Peter fell into public sin. Did Paul take Peter aside, saying, “Hey, Pete, we have a problem here…?” No, Paul tells us that he withstood Peter, calling him out, “before them all.” (verses 14-21) How did Peter respond? While Paul does not record Peter’s response, Peter, at the end of his life, also writing under the prompting and superintendence of the Holy Spirit, wrote that Paul’s writings were Scripture—the word of God (2 Peter 3:15-16). So, by example and approved precedent, Scripture teaches that public sin requires public rebuke and correction.
SITUATION #3–1 Corinthians 5:1-13
We see yet another example of public sin requiring public rebuke in 1 Corinthians 5. The church in Corinth had a “member” who was engaged in an incestuous relationship with his stepmother. It was not a private sin against another member of the congregation—it was an open scandal being advertised to the entire city. And what did Paul, under the authority of the Holy Spirit, tell them to do about the matter? He told the church to make a public example of him. He told the church to deliver him to Satan, (verse 5) to purge him, (verse 7) not keep company with him, (verses 9, 11) and to put him away [remove him] (verse 13). So, in other words, a so-called believer engaging in public, unrepentant sin was to be publicly rebuked and shunned.
SITUATION #4–1 Timothy 5:20
Those who are sinning rebuke in the presence OF ALL, that the rest may also fear.
Note the context carefully. Paul is not talking about a private matter between two believers. He is dealing with the issue of elders caught in public sin [and teaching false doctrine IS a sin]. Public sin requires public rebuke and correction.
At the same time, there is a double-edged sword in play here, because Paul is dealing with elders being accused of sin, there is the antithesis here that those who publicly bring a false accusation against an elder [pastor] must face public rebuke.
So we see in the final analysis that there is no absolute command that all sin must be privately confronted prior to public correction being implemented. As indicated in Scripture, some situations demand public correction without any attempt at prior private correction.
* Unless otherwise noted, all Scriptures are taken from the New King James Version. Copyright © 1979, 1980, 1982 by Thomas Nelson, Inc. Used by permission. All rights reserved.
 Spiros Zodhiates, The Hebrew-Greek Key Word Study Bible (Chattanooga, AMG, 2015), p. 2423.
 Zodhiates, p. 2500. See also William Mounce, Complete Expository Dictionary of Old and New Testament Words (Grand Rapids: Zondervan, 2006), p. 22.
 We still see churches today seeking to impose man-made traditions over the word of God when they impose rules like: (1) No attendance at movies or stage plays. (2) No playing card games. (3) No playing games using dice. (4) No use of tobacco products. (5) No consumption of alcoholic beverages. (6) No consumption of carbonated soft drinks. (7) No consumption of drinks containing caffeine. And these are only some of the man-made traditions which have made their way into some churches.
 W.E. Vine, New Testament Word Pictures: Romans to Revelation (Nashville: Thomas Nelson, 2015), p. 146.