It's generally accepted that you shouldn't do any more than
formatting into a markdown code block
if you're feeling generous, removing cruft like rogue tabs and making sure the code all lines up nicely (whilst honouring the OP's brace style)
where the language allows statements over multiple lines, adding a carriage return (and where required a line continuation character) here and there to reduce horizontal scroll.
removing excessive carriage returns between lines of code
Changing code style would be off-limits, as would doing things like turning (using C# as an example):
List<Thing> things = repo.GetThings()
into
var things = repo.GetThings()
Because now you're no longer working with the same code the OP is trying to debug.
See also:
httphttps://meta.stackexchange.com/questions/101583/when-is-it-appropriate-to-edit-someone-elses-code
httphttps://meta.stackexchange.com/questions/88627/how-far-can-i-refactor-someone-elses-code -