It must certainly be observed that heretics who do not receive the Old Testament are accustomed, when reading this passage, to make a slander, and they say: See how Jesus the son of Nave had no humanity in him, in that, while granting salvation to men who had come to him as suppliants, he inflicted upon them the mark of ill repute and the yoke of servitude. If a soul less instructed in the divine Scriptures hears these things, it can at once be weakened and endangered, so that it flees from the catholic faith; for they do not understand these men's deceptions. For Jesus held a fitting judgment... toward them according to the measure of their faith. But moreover "Rahab the harlot," who believed with whole faith together with "all her house" and received the Israelite spies with fullest devotion, was received wholly into the fellowship and society of the people, and it is written of her that "she was joined to the sons of Israel unto this present day." But those men, who loved the fellowship of the Israelite nation not so much as, terrified by fear of their own destruction, they "came to Jesus with cunning and fraud"—how could they earn liberty of life and fellowship of the kingdom by servile deceits? In short, do you wish to know that a condition worthy of the baseness of their mind was dispensed toward them by Jesus? They themselves say, "we have heard how great things the Lord did" for you through the Red Sea and in the desert. And though they said these things and confessed that they had heard and knew of the divine wonders, yet they did nothing worthy of faith, nothing worthy of admiration of such great powers. And therefore Jesus, seeing their narrow and meager resolve in faith, preserves a most just moderation toward them, so that they might earn salvation, though they had brought but little faith, yet would not receive the highest degree of the kingdom or of liberty, because their faith was ennobled by no addition of works, since the Apostle James declares that "faith without works is held to be dead."
Source: HOMILIES ON JOSHUA 10.2