Imam said in this regard in his famous work of “an exposition of Forty Hadith” as following:
My friend, be judicious and careful in your actions. Demand from yourself an account of every deed.
Cross-examine yourself for every detail; try to evaluate your deeds through introspection whether they were meant for the realization of virtue or motivated otherwise.
What motivated you to ask questions about mid-night prayers? Was it purely for the sake of God with an intention to perform such prayers, or for projecting your image as a deeply religiously person?
Why is it that you are eager to inform others about your pilgrimage by all possible means and about the number of times you undertook it?
Why are you not content with confining your charitable deeds to yourself alone, and what do you want to gain by informing the others of your acts of charity, for as soon as you find an opportunity you announce them?
If it is undertaken for the sake of God, and you intend that people should imitate you, and you think in terms of (the one who shows the path of virtue is as worthy as-the doer of it) while performing this deed, its display is justified; thank God, for He has enabled you to act with a clear conscience and pure heart.
But beware of the guiles of Satan while interrogating your self, for he can project the acts adulterated with riya’ as selfless and sacred.
If your action is not for the sake of God, then it is better to abstain from doing what you have been doing, for it amounts to sum’ah, i.e. advertisement of false virtues, which is a branch of the accursed tree of riya’; for God Almighty does not approve of it and condemns its perpetrator to Sijjin.
We ought to seek refuge in God from the vice of deceit, whose guiles are very subtle. We have a general idea that our deeds are not pure and sincere, because had we been His true servants, why does the Devil, despite promising not to impede the actions of His true servants, disturb our sanctity and make us an instrument of his evil designs?
In the words of my respected teacher, the Devil is the watchdog of the Almighty’s court; he does not bark at the person who is near to God, and does not bother him.
As the watchdog does not drive the friends of the master away from the house, in the same way, the Satan also recognizes God’s friends, and does not allow any stranger to get access to Him.
Therefore, whenever you realize that the Satan interferes in your affairs, you should immediately know that your actions are not performed with sincere intentions and are not meant for the Almighty. If you are a sincere believer in God, why doesn’t your tongue pour forth words of wisdom, coming from the heart?