I have seen a question that has some poorly formatted code in it. Should I edit it to fix the formatting?
All edits to questions and answer should preserve the meaning and intent of the original writer. Edits to code are no exception to this.
Renaming variables should not be done, as this doesn't improve the post in any way, except the variable names are not appropriate or are offensive.
Changing brace style, altering minor spacing, and similar edits are frowned upon as they aren't always seen as an improvement.
Examples of proper code edits would be:
- Trimming large amounts of whitespace, which improve readability by eliminating horizontal scrolling and compacting code vertically.
- Fixing very poor, or inconsistent, indentation, likely as the result of a bad copy/paste.