Again, double answer:
The easy one: whoever wrote it.
The real world one: No one. That's the beauty of code. First of all, "code quality" is a subjective thing. What's good code to me might be bad code to someone else and vice versa, so it's always kinda delicate to blame someone. Also, this "someone" is not always known and also, not always reachable (example: someone who left the company your work for). Anyway, it makes it hard to know who is responsible and even when you know, there nothing you can really do.
If you are leader, what would you try to avoid the dirty code just you think in your team?
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.