The Commandments and moral life · Question 5
If I get angry or a bad thought comes into my head, have I already sinned?

The question: “Do I have to confess just for having a thought or a feeling I never wanted?”
The Church's answer: Feelings such as joy, sadness, fear, and anger are natural movements of the human heart, and in themselves they aren't automatically good or evil. There is also a difference between an unwanted thought or a temptation arising, and freely welcoming it, enjoying it, and choosing to act on it. Jesus too was tempted, and did not sin. Moral responsibility looks at how a feeling is taken up by reason and will and carried into action.
Anger can make you notice an injustice, but feeding that anger and consenting to insult or to hurt someone can become sin. Fear helps you get away from danger, though it sometimes blocks a good action too. Rather than crushing feelings like shameful enemies, name them, express them safely, and train them so that reason and faith can choose a good direction. If checking over and over to get rid of an unwanted thought grows worse, you can get help from a counselor.
If they press further: “If I couldn't push a bad thought away and it tormented me for a long time, does that mean I consented?” — that a thought stayed a long time is not the same as the will having chosen it. Calmly tell apart whether you wanted it, whether you decided to enjoy it and feed it, and whether you tried to carry it into action. With obsessive thoughts especially, you can ask a confessor you trust and a mental-health professional for help.
In one sentence: “Feelings, unwanted thoughts, and temptations aren't sins in themselves. What matters is how you take them up and what you then freely choose.”