Deuteronomy 17:2

2 If you find anyone within the towns that God, your God, is giving you doing what is wrong in God's eyes, breaking his covenant

Deuteronomy 17:2 Meaning and Commentary

Deuteronomy 17:2

If there be found among you, within any of thy gates which the
Lord thy God giveth thee
In any of their cities in the land of Canaan:

man or woman that hath wrought wickedness in the sight of the Lord thy
God:
as all that is wrought is in the sight of the omniscient God; here it means not any kind of wickedness, for there is none lives without committing sin of one sort or another, all which is known to God the searcher of hearts, but such wickedness as is after described:

in transgressing his covenant;
that is, his law, and particularly the first table of it, which respects divine worship, and which is in the nature of a marriage contract or covenant; which, as that is transgressed by adultery committed by either party, so the covenant between God and Israel was transgressed by idolatry, which is spiritual adultery, and going a whoring after other gods, as it follows:

Deuteronomy 17:2 In-Context

1 And don't sacrifice to God, your God, an ox or sheep that is defective or has anything at all wrong with it. That's an abomination, an insult to God, your God.
2 If you find anyone within the towns that God, your God, is giving you doing what is wrong in God's eyes, breaking his covenant
3 by going off to worship other gods, bowing down to them - the sun, say, or the moon, or any rebel sky-gods -
4 look at the evidence and investigate carefully. If you find that it is true, that, in fact, an abomination has been committed in Israel,
5 then you are to take the man or woman who did this evil thing outside your city gates and stone the man or the woman. Hurl stones at the person until dead.
Published by permission. Originally published by NavPress in English as THE MESSAGE: The Bible in Contemporary Language copyright 2002 by Eugene Peterson. All rights reserved.