In Romans 1, Paul described how humanity had become degenerate, immoral, and law breaking. This is because they walked away from a true knowledge of God and embraced idolatry. But in chapter 2 Paul transitioned from the idolaters to legalists. Surprisingly Paul accused the legalists of being as immoral as the idolaters.
Therefore you are without excuse, every man of you who is continually passing judgment, for in that you judge another, you condemn yourself; for you who judge are practicing the same things.
2 And we know that the judgment of God rightly falls upon those who are continually practicing such things.
3 And do you suppose this, O man, when you pass judgment upon those who practice such things and do the same, that you will escape the judgment of God? (Rom 2:1-3)
What Paul is essentially saying is that the idolaters and the law keepers are both trapped by sin and the Fall. The law keeper tries to appear moral but cannot be and the idolaters do not care to be moral. Christians must not forget that an overemphasis on rule keeping and morality from a Christian perspective is a cover-up for hypocrisy. The only hope we have is the work of Christ and the power of the Holy Spirit. We cannot rely on our ability to keep the rules.