The study introduces a new method for predicting software defects based on Residual/Shuffle (RS) Networks and an enhanced version of Fish Migration Optimization (UFMO). The overall contribution is to improve the accuracy, and reduce the manual effort needed. The originality of this work rests in the synergic use of deep learning and metaheuristics to train the software code for extraction of semantic and structural properties. The model is tested on a variety of open-source projects, yielding an average accuracy of 93% and surpassing the performance of the state-of-the-art models. The results indicate an overall increase in the precision (78-98%), recall (71-98%), F-measure (72-96%), and Area Under the Curve (AUC) (78-99%). The proposed model is simple and efficient and proves to be effective in identifying potential defects, consequently decreasing the chance of missing these defects and improving the overall quality of the software as opposed to existing approaches. However, the analysis is limited to open-source projects and warrants further evaluation on proprietary software. The study enables a robust and efficient tool for developers. This approach can revolutionize software development practices in order to use artificial intelligence to solve difficult issues presented in software. The model offers high accuracy to reduce the software development cost, which can improve user satisfaction, and enhance the overall quality of software being developed.