4

Looking through the suggested edits queue, I've come across many suggestions that change code blocks. I've found myself rejecting most of them. In many (most, if not all) of these, the edits make big changes that fix substantial bugs (either compile- or runtime) in the code in question. I feel like these sorts of edits should be suggested in comments, since they might alter the meaning of code (even if the original code wouldn't compile) in such a way that the question might lose meaning.

Am I right to reject these changes? I didn't doubt myself at first, but as I see more and more of these I thought it was worth confirming the expected behavior for reviewers.

There are two particular cases where I'm curious, and I realize that the answers might not be congruent:

  • When should changes in question code be accepted or rejected?
  • When should changes in answer code be accepted or rejected?

This is a good example of an answer of an answer. I see this particular edit has been rejected on the grounds that it is a failed attempt to comment, which I definitely agree with, but it illustrates the point.

There have been other examples I've seen wherein people suggested adding a semicolon, or other minor typographical fixes. I tend to feel the same way about these edits, since semicolons do alter the meaning of code, even if (or especially since) it wouldn't compile without them.

On the other hand, there are other cases where huge bugs are fixed, which one could argue might even be answer-worthy.

So where should one draw the line? Should all code edits be rejected? That seems a little extreme, but it feels weird letting them through, even in small cases. I certainly don't mind suggesting these edits be placed in comments.

0

1 Answer 1

5

These comments pertain to code changes, and exclude formatting:

When should changes in question code be accepted or rejected?

These changes should be rejected in pretty much all cases, as the original code may be part of the problem and fixing the code may change the problem.

When should changes in answer code be accepted or rejected?

Answers are a bit more flexible than questions, so it depends. If it's a simple overlooked typo then there is no harm in fixing it. If it changes the nature of the answer by either substantially changing code or by introducing version dependent code then it should be rejected.

IMVHO members who only have edit suggestion privileges should refrain from these sorts of suggestions (unless it is the basic typo).

As for formatting (which is going to be the large majority of the edits you see): it also depends. If it measurably improves the readability of the post then approve it. If it's just inconsequential tweaking then reject it.

4
  • Good point on formatting, it didn't even occur to me that that was related to code, but it obviously is. I definitely evaluate that separately. But fair enough, this is all what I would have guessed. Just making sure I was right to be rejecting all those. Is there a suggested rejection reason we should set for code-altering questions or answers like that? I'm sometimes tempted by whichever one follows that "it will change the question's meaning," but that's not even always the case. I often just write my own comment, but I know that's not as nice from a database perspective. Commented Jul 23, 2014 at 4:04
  • 1
    @MatthewHaugen You can use too minor for most of the rejections, and maybe radical change or custom for code edits in a question. You are right with your reject-by-default approach, but don't be surprised to see many accepted anyway as there are lots of robo-reviewers who don't do a good job.
    – slugster
    Commented Jul 23, 2014 at 4:19
  • I just saw an edit that changes the code and logic with a comment 'as discussed in comments'. I guess the issue has been discussed between the proposer and answerer. I felt that the modification should be done only by the answerer. For the time being, I just skipped it. But in regular flow, am I right in thinking that it should be rejected? Commented Sep 3, 2015 at 4:55
  • @KDM Unless you can validate the suggestion by checking the comments then you should reject it. I agree that for changes like this it should be up to the OP of the answer or someone with sufficient privileges to outright edit the answer.
    – slugster
    Commented Sep 3, 2015 at 9:24

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