As a >2k user on SO, I often review suggested edits.

  • If an edit formats code, I will accept.
  • If an edit changes code, I (along with everyone else) reject it.

In fact, I've yet to see an edit that changes anything in a code block other than white space that isn't invalid.

So, my feature-request is to forbid <2k users to suggest edits that change code blocks (except whitespace).

Note that code formatting includes both addition and subtraction of whitespace.

At the very least, put a big banner in the review queue that says

WARNING: This edit changes code. There is a high probability it should be rejected as invalid.

I believe this minor change to the system would lessen the number of rejected edits - every rejected edit is an edit that wasted at least three users' time.

I would think it's obvious, but those users should be able to change code in their own posts.

  • What if it converts a link to code to a block of code?
    – Cole Tobin
    May 26, 2013 at 4:56
  • @Cole I would say users can add code blocks, but can't alter existing code blocks beyond whitespace.
    – Undo
    May 26, 2013 at 4:57
  • 1
    I would not go with this. If someone edits your code, you get a notification. If you feel an incorrect edit has occured you have the right to revert it back. May 26, 2013 at 4:58
  • 2
    How many newbies know or are comfortable reversing a bad edit from an "established" user, @AnoopVaidya? In my experience, not many. Also it's vastly better to prevent a problem, or catch it at its source than to hope that someone comes along to clean up the mess. May 26, 2013 at 5:06
  • 1
    @AwesomePoodles makes a good point. Even with 3k rep, I'm not comfortable down voting or flagging an established user.
    – Cole Tobin
    May 26, 2013 at 5:13

2 Answers 2


While reviewing, I have come across numerous times that a code edit was suggested because it was added due to a comment, fixed because of a clear spelling error, or the OP added what actually corrected their problem. Of course, there are plenty of times that a code edit is invalid, but to add this in would likely deter people who have valid edits.

To specifically address the point that everyone rejects code edits, I can tell you that I do not without first fully investigating if it was a reasonable change or not. I have no problem accepting a code edit that actually adds to the usefulness of an answer.

Editing code in a question, on the other hand, is an entirely different situation, where I would wholeheartedly agree with your suggestion.

  • 1
    There is one legitimate reason to edit code in questions: removing personal/sensitive information. May 26, 2013 at 6:53
  • That is very true. I've had to remove, on several occasions, database credentials from a question. I do wonder if that is small enough of a percentage of code edits in a question where it might still be useful to consider some sort of a warning about suggesting the edit.
    – jprofitt
    May 26, 2013 at 6:56
  • 3
    I like the idea of a warning. Something along the lines of "please don't fix the code in a question. Instead, consider posting an answer (if it resolves the asker's issue) [or a comment][[if user's rep >= 50]]/[or wait until somebody else mentions the mistake][[if user's rep < 50]]". May 26, 2013 at 7:02

If an edit changes code, I (along with everyone else) reject it.

Wrong. There are good reviewers who don't blindly reject suggested edits that change code.

In fact, I've yet to see an edit that changes anything in a code block other than white space that isn't invalid.

It is almost always wrong to change code (beyond formatting it) in questions, but in my experience there are very few suggested edits that even try, so even if every single one of these was wrong there would be no reason to add a software feature to reject them immediately. (There are however lots and lots of suggested edits that introduce bad formatting — should we automatically reject suggested edits that only change formatting?)

There is nothing intrinsically wrong with changing the code in an answer. Like changing the rest of the text, it should be done to improve clarity or correct minor mistakes.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .