Can. 959 In the sacrament of penance the faithful who confess their sins to a legitimate minister, are sorry for them, and intend to reform themselves obtain from God through the absolution imparted by the same minister forgiveness for the sins they have committed after baptism and, at the same, time are reconciled with the Church which they have wounded by sinning.
…
Can. 987 To receive the salvific remedy of the sacrament of penance, a member of the Christian faithful must be disposed in such a way that, rejecting sins committed and having a purpose of amendment, the person is turned back to God.
Can. 988 §1. A member of the Christian faithful is obliged to confess in kind and number all grave sins committed after baptism and not yet remitted directly through the keys of the Church nor acknowledged in individual confession, of which the person has knowledge after diligent examination of conscience.
§2. It is recommended to the Christian faithful that they also confess venial sins.
…