Not sure what translation you used but this is a better translation and fits the context
James 2:9 but if you [
e]show partiality, you commit sin, and are convicted by the law as transgressors
prosópolémpteó: To show partiality, to be a respecter of persons
Original Word: προσωπολημπτέω
Part of Speech: Verb
Transliteration: prosópolémpteó
Pronunciation: pro-so-po-lay-MP-teh-o
Phonetic Spelling: (pros-o-pol-ape-teh'-o)
Definition: To show partiality, to be a respecter of persons
Meaning: I favor specially, show partiality.
James 2:10 For whoever shall keep the whole law, and yet stumble in one
point, he is guilty of all. 11
For He who said, “
Do not commit adultery,” also said, “
Do not murder.” Now if you do not commit adultery, but you do murder, you have become a transgressor of the law.2 So speak and so do as those who will be judged by the law of liberty.
What “whole law” is James only quoting and contrasting, saying if you break one of these commandments, you break them all? Who is the “He who said” James is quoting?
It’s God writing and speaking the Ten Commandments found in Exodus 20 that He added no more to Deut 5:22 breaking one we break them all and what we will be Judged by the law of Liberty. If we love God we would want to keep His commandments because His law is a reflection of His character, which we are to take on His image. God is trying to save us from the bondage of sin hence why they are called the law of liberty
The Ten Commandments
20 And God spoke all these words, saying:
2 “I
am the Lord your God, who brought you out of the land of Egypt, out of the house of [
a]bondage.
3 “You shall have no other gods before Me.
4 “You shall not make for yourself a carved image—any likeness
of anything that
is in heaven above, or that
is in the earth beneath, or that
is in the water under the earth; 5 you shall not bow down to them nor [
b]serve them. For I, the Lord your God,
am a jealous God, visiting[
c] the iniquity of the fathers upon the children to the third and fourth
generations of those who hate Me, 6 but showing mercy to thousands, to those who love Me and keep My commandments.
7 “You shall not take the name of the Lord your God in vain, for the Lord will not hold
him guiltless who takes His name in vain.
8 “Remember the Sabbath day, to keep it holy. 9 Six days you shall labor and do all your work, 10 but the seventh day
is the Sabbath of the Lord your God.
In it you shall do no work: you, nor your son, nor your daughter, nor your male servant, nor your female servant, nor your cattle, nor your stranger who
is within your gates. 11 For
in six days the Lord made the heavens and the earth, the sea, and all that
is in them, and rested the seventh day. Therefore the Lord blessed the Sabbath day and hallowed it.
12 “Honor your father and your mother, that your days may be long upon the land which the Lord your God is giving you.
13 “You shall not murder.
14 “You shall not commit adultery.
15 “You shall not steal.
16 “You shall not bear false witness against your neighbor.
17 “You shall not covet your neighbor’s house; you shall not covet your neighbor’s wife, nor his male servant, nor his female servant, nor his ox, nor his donkey, nor anything that
is your neighbor’s.”