"And the LORD said: Shall I hide from Abraham [what I am doing]?" (Genesis 18:17) And thus said the Holy One, blessed be He: I gave all this land to Abraham, and now I wish to destroy five cities of his on account of their sin; and if I do not reveal it to him, he will say, "Perhaps the Holy One, blessed be He, has gone back on what He said."
Why God Refused to Hide Sodom's Doom from Abraham
Midrash Aggadah, Genesis 18:17
וה' אמר המכסה אני מאברהם. וכן אמר הקב"ה אני נתתי כל הארץ הזאת לאברהם, ועתה אני רוצה לאבד חמשה עיירות משלו בשביל חטאתם, ואם אין אני מגלה לו, אומר שמא הקב"ה חזר בו: