Ayesha reported,

The Messenger of Allah ﷺ heard the voices of two disputants at the door, raised in argument. One of them was asking the other to reduce what was owed and to be lenient with him in some matter, while the other was saying, "By Allah, I will not do it."The Messenger of Allah ﷺ came out to them and said, "Where is the one swearing by Allah that he will not do a good deed?"The man said, "It is I, Messenger of Allah, and he may have whichever of those he prefers."

Azami 7075

Sahih

عن عائشة قالت

سمع رسول الله ﷺ صوت خصوم بالباب عالية أصواتهما، وإذا أحدهما يستوضع الآخر ويسترفقه في شيء وهو يقول: والله لا أفعل، فخرج عليهما رسول الله ﷺ فقال: أين المتألي على الله لا يفعل المعروف؟ فقال: أنا يا رسول الله، وله أي ذلك أحب.

الأعظمي 7075صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Oaths and vows
Chapter
Faith
Section
Rebuke of one who swears by Allah that He will not do good
Numbering
Jami al-Kamil 7075 (2nd edition)