Complete Commentary on the Whole Bible, by Matthew Henry, at sacred-texts.com
David, in this psalm, appeals to God touching his integrity.
David here, by the Spirit of prophecy, speaks of himself as a type of Christ, of whom what he here says of his spotless innocence was fully and eminently true, and of Christ only, and to Him we may apply it. We are complete in him. The man that walks in his integrity, yet trusting wholly in the grace of God, is in a state of acceptance, according to the covenant of which Jesus was the Mediator, in virtue of his spotless obedience even unto death. This man desires to have his inmost soul searched and proved by the Lord. He is aware of the deceitfulness of his own heart; he desires to detect and mortify every sin; and he longs to be satisfied of his being a true believer, and to practise the holy commands of God. Great care to avoid bad company, is both a good evidence of our integrity, and a good means to keep us in it. Hypocrites and dissemblers may be found attending on God's ordinances; but it is a good sign of sincerity, if we attend upon them, as the psalmist here tells us he did, in the exercise of repentance and conscientious obedience. He feels his ground firm under him; and, as he delights in blessing the Lord with his congregations on earth, he trusts that shortly he shall join the great assembly in heaven, in singing praises to God and to the Lamb for evermore.