Hadithcore
Mishkat al-Masabih, 734, 735

Hakim b. Hizam said that God's Messenger prohibited retaliation being taken in a mosque, the recitation of poems in it, and the infliction of punishment in it. Abu Dawud in his <i>Sunan</i> and the author of <i>Jami‘ al-usul</i> (<i> Ibn al-Athir</i>) in his work transmitted it from Hakim, but in <i>al-Masabih</i> it is transmitted from Jabir.

وَعَنْ حَكِيمِ بْنِ حِزَامٍ قَالَ: نَهَى رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنْ يُسْتَقَادَ فِي الْمَسْجِدِ وَأَنْ يُنْشَدَ فِيهِ الْأَشْعَارُ وَأَنْ تُقَامَ فِيهِ الْحُدُودُ. رَوَاهُ أَبُو دَاوُدَ فِي سُنَنِهِ وَصَاحِبُ جَامِعِ الْأُصُولِ فِيهِ عَنْ حَكِيمٍ وَفِي المصابيح عَن جَابر

References1 variant
In-Book Reference
Book 4, Hadith 163