Abbas - Tanwîr al-Miqbâs min Tafsîr Ibn ‘Abbâs
(Say) O Muhammad!: (Whether ye hide that which is in your breasts) what is in your hearts of hatred and enmity towards Muhammad (pbuh) (or reveal it) by showing abuse, defamation and waging war, (Allah knoweth it) Allah will record it and requite for it. (He knoweth that which is in the heavens and that which is in the earth) of good and evil, what is secret and what is revealed, (and Allah is Able to do all things) regarding the dwellers of the heavens and the dwellers of earth. This verse was revealed about the hypocrites and the Jews.
Say, to them: ‘Whether you hide what is in your breasts, in your hearts, of patronage to them, or disclose it, manifest it, God knows it and, He, knows what is in the heavens and what is in the earth; and God is Able to do all things, and this includes punishing those who patronise them.
Allah tells His servants that He knows the secrets and apparent matters and that nothing concerning them escapes His observation. Rather, His knowledge encompasses them in all conditions, time frames, days and instances. His knowledge encompasses all that is in heaven and earth, and nothing not even the weight of an atom, or what is smaller than that in the earth, seas and mountains, escapes His observation. Indeed,
وَاللَّهُ عَلَى كُلِّ شَيْءٍ قَدِيرٌ
(And Allah is able to do all things.) and His ability encompasses everything. This Ayah alerts Allah's servants that they should fear Him enough to not commit what He prohibits and dislikes, for He has perfect knowledge in all they do and is able to punish them promptly. And He gives respite to some of them, then He punishes them, and He is Swift and Mighty in taking account. This is why Allah said afterwards,
(On that Day man will be informed of what he sent forward, and what he left behind.) 75:13.
When the servant sees his good deeds, he becomes happy and delighted. When he sees the evil deeds he committed, he becomes sad and angry. Then he will wish that he could disown his evil work and that a long distance separated it from him. He will also say to the devil who used to accompany him in this life, and who used to encourage him to do evil;
("Would that between me and you were the distance of the two easts ـ a horrible companion (indeed)!) 43:38.
Allah then said, while threatening and warning,
وَيُحَذِّرُكُمُ اللَّهُ نَفْسَهُ
(And Allah warns you against Himself) meaning, He warns you against His punishment. Allah then said, while bringing hope to His servants, so that they do not despair from His mercy or feel hopeless of His kindness,
وَاللَّهُ رَءُوفٌ بِالْعِبَادِ
(And Allah is full of kindness with the servants)
Al-Hasan Al-Basri said, "Allah is so kind with them that He warns them against Himself.'' Others commented, "He is merciful with His creation and likes for them to remain on His straight path and chosen religion, and to follow His honorable Messenger.''
Maududi - Sayyid Abul Ala Maududi - Tafhim al-Qur'an
That is, "It is simply out of His extreme compassion for you that Allah warns you beforehand of those things that might lead you to ruin."
Say: “Whether you hide what is in your breasts or disclose it God knows it and knows what is in the heavens and what is in the earth; and God is Able to do all things.” There is nothing that escapes His knowledge so do not be grieved by any calamity that afflicts you. Soon He will bring you succor and response and soon the affliction and trial will disappear. He will hasten [His] assistance and protection.