During peer-review, should I comment on the authors' messy code?
If the authors have provided a link to their code as a reference, then it is appropriate to offer commentary, particularly if the article is based on the code.

However, I would recommend making the critique constructive: offer concrete suggestions for how to improve it rather than just saying it’s “messy” or “sloppy” and needs to be “cleaned up.”