The court shall also determine whether the zoning ordinance or by-law is not inconsistent with a local comprehensive plan certified by the regional planning agency, or was adopted as a regulation to implement a district of critical planning concern, pursuant to chapter 716 of the Acts of 1989 or chapter 831 of the Acts of 1977, respectively, as those acts may be amended.