The plaintiff, a building contractor, brings this action against the owner of a brick building located on Seventh Street, in Springfield, to recover a balance alleged to be due to the plaintiff on account of a written contract between the parties under which the plaintiff has added a second story to the defendant’s building.
The trial judge has refused to find for the plaintiff on *451the written contract, presumably because of certain deficiencies in performance. Bowen v. Kimbell, 203 Mass. 364. Searls v. Loring, 275 Mass. 403. He has, however, after deducting $85 for the deficiencies, found for the plaintiff on quantum meruit counts in the sum of $1,349.19, Hayward v. Leonard, 7 Pick. 180, and he has found for the plaintiff in the further sum of $356.50 on a count for extra work.
The defendant contends that the plaintiff should not recover for any work covered by the contract or for the greater part of the extra work, because certain of the specifications of the contract and certain parts of the building as actually constructed were inconsistent with the requirements of the building ordinances of the city of Springfield. It is argued that both the contract itself and the manner of performing it were illegal. Eastern Expanded Metal Co. v. Webb Granite & Construction Co. 195 Mass. 356. The matters argued as violations of the ordinance relate to the thickness of certain walls and to the composition of the mortar used.
It may be doubted whether the specifications of the contract itself are really at variance with the ordinance, and it has been held that a variation of this kind appearing in the actual performance of the work and not required by any illegal term of the contract, does not necessarily bar recovery. Fox v. Rogers, 171 Mass. 546. But we do not stop to discuss these matters, for we are of opinion that these contentions are not now open to the defendant. Illegality was not pleaded as a defence. In O’Brien v. Shea, 208 Mass. 528, at page 535, it was said that in actions at law "like the one at bar . . . the court will recognize no absolute duty to interfere and of its own mere motion to sustain a defense not set up by the party, and generally will not so interfere, unless, first, the plaintiff’s declaration shows that he relies upon an illegal agreement or violation of law, or, secondly, unless he has been obliged to show his own guilt in fully proving his case.” And in Nowell v. Equitable Trust Co. 249 Mass. 585, at page 595, this court said "Illegality of a contract, unless of such nature as to *452shock the conscience or to be inherently wrong, or unless patent upon the plaintiff’s own case, usually must be pleaded.” Williston on Contracts, § 1630a. The judge found that the building is safe, sound and substantial in all respects; that the plans for the building and the building itself were approved by the building department of the city; that the mortar is good, strong, suitable mortar; that “deviation by the plaintiff from the exact letter or requirements of the Building Code . . . was not patent in the presentation of the plaintiff’s own case . . . and in fact, was not a matter of any practical importance”; and that “any such deviation was not such a violation as to be inherently wrong or to shock the conscience or to be so against public policy as to require the Court of its own motion to take cognizance of it.” We cannot say that these findings are unjustified. The judge was not bound to believe witnesses called by the plaintiff, other than the plaintiff himself. Haun v. LeGrand, 268 Mass. 582, Salem Trust Co. v. Deery, 289 Mass. 431, 435; nor was he bound to find on the evidence that proof of the plaintiff’s case necessarily involved proof of illegality. See Granger v. Ilsley, 2 Gray, 521; Suit v. Woodhall, 116 Mass. 547.
The evidence fails to disclose such inherently wrongful conduct as to require the court to intervene for the preservation of public policy or morality or the maintenance of its own dignity. If a party who has received the benefit of a well constructed building erected substantially in accordance with his contract wishes to rely in defence upon variations from some of the manifold specifications of a modern building ordinance, it is reasonable that he should apprise the plaintiff in advance of trial of the issues which he intends to raise by properly pleading his defences. Whittingslow v. Thomas, 237 Mass. 103. Bursaw v. Pederson, 284 Mass. 471, 479. A case like this is to be distinguished from Reuter v. Ballard, 267 Mass. 557, and other cases cited by the defendant where the illegality suggested by the evidence was such that it would be clearly contrary to public policy to enforce a contract tainted thereby.
*453The defendant further urges that the plaintiff cannot recover because he changed the proportions of cement and lime in the mortar from those specified in the contract and therefore did not make the effort in good faith to perform his contract fully and completely which the law requires him to make in order to recover on a quantum meruit. Smedley v. Walden, 246 Mass. 393, 399. Divito v. Uto, 253 Mass. 239, 243. The judge did expressly find that the plaintiff in good faith substantially performed his contract. The general finding for the plaintiff implied the further finding, also necessary to support it, that he endeavored in good faith to perform fully, unless there was no evidence upon which such a finding could properly be made. Dillon v. Framingham, 288 Mass. 511, 513. In addition to the evidence hereinbefore recited there was evidence that the change in the mortar was made necessary as to part of the building by an agreed change in the kind of brick used, and in general by weather conditions and because the mixture called for by the contract was producing a mortar which set too quickly; that the mortar used set properly, shows no cracks and was entirely suitable for its purpose; and that the plaintiff believed that the mixture used was best suited to secure a strong mortar. The judge finds that the defendant suffered no damage from this change. Doubtless in general an intentional departure from the contract is inconsistent with good faith. Hub Construction Co. v. Dudley Wood Works Co. 274 Mass. 493. But a rule of law which would compel a court to find bad faith because of a departure of this kind, which could be found to have been necessary to the doing of a proper job, would be too rigid and unyielding for the practical accomplishment of justice. Handy v. Bliss, 204 Mass. 513, 519. Soares v. Weitzman, 281 Mass. 409. Zarthar v. Saliba, 282 Mass. 558. Baccari v. B. Perini & Sons, Inc., ante, 297, 301. In Glazer v. Schwartz, 276 Mass. 54, cited by the defendant, the trial judge found that the plaintiff’s default was wilful.
The report shows that there was evidence from which the *454damages could be ascertained. Norwood v. Lathrop, 178 Mass. 208. A building cannot be deemed valueless, even if portions of it are constructed in violation of an ordinance.
Order dismissing report affirmed.