There are two ways to be Righteous. The first is by the law. In order to be righteous by the law, you need to keep all the laws of God.
If you have broken some law, there is no way out of that. You are now unrighteous. This is why God has made a different way
The second is by faith. To be Righteous by faith you need to believe the Word of God, like Abraham, believed God, and it was a credited to him as Righteousness.
Any wrongdoing should not change your state (as being righteous) since you are justified by faith, you will remain justified as long as you keep the faith. For this reason, the just shall live by faith. Your faith does become your life. If by some misconduct you do feel
If then not by the law, does that mean we can continue breaking the laws of God. Of cause not. In thinking like this you don’t believe that you are righteous. If you believe you are justified, then you should ensure you have not received the grace of God in vain.
Soon in doing this you will start acting that which you are. Those God justified He has also glorified.