7

Should edits with only minor code improvements be accepted. As an example, I'm reviewing an edit that changes all double quotes to single quotes and renames a variable in some javascript. With the exception of the variable rename (which is not entirely necessary), the edit is frivolous. Should I accept on the merits of a debatable variable name change?

1
  • 5
    Sounds like a terrible and wrongful edit.
    – brasofilo
    Oct 9, 2013 at 19:44

2 Answers 2

16

You should not be editing posts for subjective stylistic changes based on the personal coding preferences of the coder. If a code sample is completely unreadable (i.e. not formatted as code, has no whitespace, etc.) then applying some basic formatting to make it generally readable is okay. Taking perfectly readable code and altering it to use your personal preferences is not. Allowing such edits would just result in edit wars between people with conflicting preferences and would waste a lot of people's time without actually improving the post at all.

As for which reason to choose, I'd probably go with "invalid edit". "too minor" is probably technically correct as well, but it would probably be more confusing. The edit isn't a minor change in terms of how much is changed, it's minor in terms of the value added, but that's less obvious to the reader. This is also a case where I'm somewhat inclined to break out the custom reason to say that edits shouldn't be used to make changes based on the personal style preferences of the editor, despite my hesitation to use custom reasons in general.

6

I typically reject as invalid edit. Some people are really bad about it, though in that case, he has stopped doing it.

Now, that said, I do change code blocks like this:

SELECT sma.foo, sma.bar, m.splunge, m.the_buzz 
  FROM dbo.mort AS m INNER JOIN dbo.splunge_mort_assignment AS sma ON m.whatever = sma.whatever 
  WHERE sma.foo IN ('q','r','s','t','u','v','w','x','y','z');

To something with no horizontal scrollbars:

SELECT sma.foo, sma.bar, m.splunge, m.the_buzz 
  FROM dbo.mort AS m 
  INNER JOIN dbo.splunge_mort_assignment AS sma 
  ON m.whatever = sma.whatever 
  WHERE sma.foo IN ('q','r','s','t','u','v','w','x','y','z');

But I do this simply so I can read the bleeping question, not so that it appears in my preferred style or so that I get rep or badges or what have you. I don't do this as a suggested edit and it doesn't cause anyone else any work. If I didn't have enough rep to make the edit myself, and if I at least had any clue that a suggested edit causes other people work, I probably wouldn't suggest it unless it was really bad, like this:

SELECT sma.foo, sma.bar, m.splunge, m.the_buzz FROM dbo.mort AS m INNER JOIN dbo.splunge_mort_assignment AS sma ON m.whatever = sma.whatever WHERE sma.foo IN ('q','r','s','t','u','v','w','x','y','z');
0

You must log in to answer this question.

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