The R&A publishes the Rules of Golf. Rule 1 sets standards of player conduct. Players are expected to act with integrity, “for example, by following the Rules, applying all penalties.”
The rule adds: “Players are expected to recognize when they have breached a Rule and to be honest in applying their own penalties.”