Upon the hearing of such special proceedings, the court shall have full power and jurisdiction to examine and determine the legality and validity of and approve and confirm each and all of the proceedings for the organization of said district under the provisions of this chapter from and including the petition for the organization of the district, and all other proceedings which may affect the legality of the formation of said district or the legality or validity of said bonds, or refunding bonds, and the order for the sale, and the sale thereof, and all proceedings which may affect the authorization or validity of the contract with the United States, or the state of Washington, or other contract. The court, in inquiring into the regularity, legality or correctness of said proceedings, must disregard any error, irregularity or omission which does not affect the substantial rights of the parties to said special proceedings, and it may approve and confirm such proceedings, in part, and disapprove and declare illegal or invalid other or subsequent parts of the proceedings. The court shall find and determine whether the notice of the filing of said petition has been duly given and published for the time and in the manner in this chapter prescribed. The costs of the special proceedings may be allowed and apportioned between all of the parties, in the discretion of the court.