Software fault prediction (SFP) is a critical process in ensuring the reliability of software systems by identifying and eliminating faults. Machine learning techniques have emerged as effective methods for addressing SFP challenges. However, the large size of fault data obtained from mining software historical repositories poses a dimensionality problem due to the abundance of features (metrics). Feature selection (FS) is a valuable solution to reduce data dimensionality by identifying the most relevant features. In this research, an enhanced version of the Whale Optimization Algorithm (WOA) is proposed, by incorporating truncation selection by combining it with a single point crossover method to improve the exploration process and avoid local optima. The performance of the proposed enhancement is evaluated on 14 SFP datasets obtained from the PROMISE repository. Our comprehensive analysis demonstrates that the proposed approach outperforms the original WOA and other variants of the WOA.