The Pharisees had a false comfort, satisfaction and joy in this: that they had God’s law, and they obeyed it well (Luke 18:11-12). They rejoiced because they believed they were very spiritual, based on their own performance.
I’ve seen that it’s a temptation to root my joy in my current performance with God. If I'm doing well in my walk with God and feeling that I’ve been very faithful for a while, I can be happy. If not, it’s tempting to be discouraged and lose my joy.
That’s not God’s will. He wants me always to put my confidence and joy in what Jesus accomplished, not in my own performance. In other words, He wants me to rejoice in and boast in the Lord’s work at every moment, and have no confidence in my flesh:
Php 3:3 “For it is we who are the circumcision, we who serve God by his Spirit, who boast in Christ Jesus, and who put no confidence in the flesh”
Paul goes on to say of his previous ‘great works of the flesh’:
I consider them garbage, that I may gain Christ and be found in him, not having a righteousness of my own that comes from the law, but that which is through faith in Christ—the righteousness that comes from God on the basis of faith. (v8-9)
Paul was able to rejoice that He was right with God, disregarding all of the evil AND all of the good that he had done up to that point. He was able to do what Jesus said: “Rejoice because your names are written in Heaven” (Luke 10:20). If my name is only written in Heaven when I am doing well, I should be a sad man! That would mean my salvation isn't secure (since it would come and go along with my performance)!
But praise God our righteousness is solid, unshaken – the righteousness of Jesus that He gave me as a gift. Not the righteousness that comes when I am doing well (all my righteousness is filthy rags anyways, even when I feel I’m doing well! (Isa 64:6))
If I’m rejoicing because I believe I’ve been walking faithfully, I’m basically having faith in a works gospel. Is the good news that I have done something wonderful? Or is it that God has done something wonderful?
The 'gospel' (good news) is that God has done the work to save me and my salvation is secure in His work, my righteousness is found there alone. And my joy should be rooted there, not in my own performance.