Doping and defect control in semiconductors are essential prerequisites for their practical applications. First-principles defect calculations based on density functional theory offer crucial theoretical guidance for doping and defect control. This paper introduces the developments in the theoretical methods of first-principles semiconductor defect calculations. We will firstly introduce the method of the defect formation energy calculations, as well as finite-size errors to defect formation energies caused by the supercell method. We then present corresponding image charge correction schemes, which includes the widely used post-hoc corrections (such as Makov-Payne (MP), Lany-Zunger (LZ), Freysoldt-Neugebauer-Van de Walle(FNV) schemes), the recently developed self-consistent potential correction which performs the image charge correction in the self-consistent loop for solving Kohn-Sham equations, and the self-consistent charge correction scheme which does not require an input of macroscopic dielectric constants. Furthermore, we extend our discussions to charged defect calculations in low-dimensional semiconductors, elucidating the issue of charged defect formation energy divergence with increasing vacuum thickness under the jellium model, and introducing our theoretical model which fixes this energy divergence issue by placing the ionized electrons or holes in the realistic host band-edge states instead of the virtual jellium state. Then, we further provide a brief overview on defect calculation correction methods due to the DFT band gap error, including the scissors operator, LDA+U and hybrid functionals. Finally, to describe the defects formation energy calculations under illumination, we present our self-consistent two-Fermi-reservoirs model, which predicts well the defects and carrier concentrations under illumination in the Mg doped GaN system. This work summarizes the recent developments regarding first-principles defect calculations in semiconductors and might offer guidance for defect calculations in semiconductors especially low-dimensional ones, under both equilibrium and non-equilibrium conditions, aiding further advancements in doping and defect control within semiconductors.