I am a new approver for the Suggested Edits review queue.
After going through several of them yesterday; I found that 3 to 4 of them were just suggestions either to add or remove Stack Snippets from the post. Nothing else.
I had to skip them as I was not aware of the guidelines on this. I tried to find something in the help center or on meta. But could not find.
Could someone please shed some light on this?
2 Answers 2
Edits adding a snippet
If the snippet demonstrates the issue the OP is asking about when you click Run code snippet, approve. If not, reject.
Edits removing a snippet
If the snippet demonstrates the issue the OP is asking about when you click Run code snippet, reject. If not, it's more complicated:
If the snippet contains invalid content, approve. Examples:
- Something that isn't HTML in the HTML panel, including PHP tags.
- Something that isn't JavaScript in the JavaScript panel, including TypeScript or CoffeeScript or similar unless a client-side transpiler has also been correctly included.
Note 1: JavaScript has been changing a lot lately, some modern JavaScript doesn't look much like JavaScript from five years ago.
Note 2: React snippets may well contain what looks like invalid JavaScript in the form of JSX, but provided the Babel checkbox is checked, that's fine (details here). - Something that isn't CSS in the CSS panel, including Less or Sass.
If the snippet could be reasonably edited to demonstrate the issue the OP is asking about (for instance, it's missing a library that could readily be added) but just hasn't been, I would lean toward reject on the basis that it doesn't improve anything to go backward. But this would be vary case-by-case. The right thing where possible, of course, would be to add the missing things.
Edits editing a snippet
(Just for completeness.)
Pretty much like any other edit: If it's an improvement, approve; if not, reject.
For example:
- If the original snippet didn't demonstrates the problem and the new one does, approve.
- If the original snippet demonstrated the problem and the new one doesn't, reject.
- If the snippet should have just been removed (see above — wrong languages, etc.), reject.
- If the original snippet didn't didn't demonstrate the problem, and the new one doesn't either, but the edit improves it in some way (formatting, adding missing library, etc.), approve; if not, reject.
-
2There is a third category: edits editing a snippet. Not sure if the question is about those. In any case, I approve of suggested edits that add missing external libraries and/or stylesheets. When a suggested edit introduces a snippet, but misses something small that breaks it (for example, not referencing an external library), I like to improve the edit accordingly to make it run.Just a student– Just a student2017年05月02日 14:33:39 +00:00Commented May 2, 2017 at 14:33
-
14This is fairly comprehensive, but I just want to point out explicitly - Stack Snippets only support HTML, CSS, and JavaScript (and JS libraries that are properly linked and supported within the Snippet). Questions with code in any other language should not have a Stack Snippet (like C++, Python, Java, Lua, Haskell, etc.). Likewise, a question that does not have enough code to produce an output (e.g. if the code is only CSS, or if it is JavaScript that edits markup without actually including said markup in the HTML section) should not be in a runnable Stack Snippet.TylerH– TylerH2017年05月02日 14:59:23 +00:00Commented May 2, 2017 at 14:59
-
1Also, HTML that is tangentially related to the question should not be put in a snippet. (I may still be a little sore.) For example, questions about Pug probably don't need a snippet to display the output (example).Andrew Myers– Andrew Myers2017年05月02日 16:10:29 +00:00Commented May 2, 2017 at 16:10
-
Also a small pedantic comment about the "doesn't run" thing: since questions are usually about "why doesn't my code work", snippets that produce no output (or malformed output) can easily be what the OP did intend to show! So any edit to a snippet that makes it run properly should be scrutinised carefully to see if it shouldn't be rejected as "attempt to answer".Mr Lister– Mr Lister2017年05月04日 12:04:29 +00:00Commented May 4, 2017 at 12:04
-
1@MrLister: I'll clarify. "Doesn't run" means exactly taht: Doesn't run. At all. As opposed to running, incorrectly, demonstrating the problem the OP is asking about.T.J. Crowder– T.J. Crowder2017年05月04日 12:05:08 +00:00Commented May 4, 2017 at 12:05
-
@MrLister: Didn't need "runs and demonstrates" at all, really, did I? Fixed. :-)T.J. Crowder– T.J. Crowder2017年05月04日 12:10:31 +00:00Commented May 4, 2017 at 12:10
-
But was with any other edits. If there are other things that obviously need to be improved in the question and the editor does not do those things and only removes the stack snippet then I tend to Reject and Edit and make those improvements as well.Dijkgraaf– Dijkgraaf2017年05月04日 23:46:52 +00:00Commented May 4, 2017 at 23:46
-
1My take as one who OFTEN try to help newcomers not getting scared off by their question massively being voted down: I convert code to snippet, especially when the new OP posts 2 or 3 (poorly) formatted sets of html, JS and CSS. I ALSO convert to a snippet that may or may not be runnable and ask OP to complete the snippet to make a [mcve] of said snippet. In most cases they do, and everybody is happy. In some cases they do not and then I may be told off for creating the snippet in the first place. I will still try to help a user update a question instead vote down for missing informationmplungjan– mplungjan2022年09月09日 10:21:43 +00:00Commented Sep 9, 2022 at 10:21
-
1@mplungjan - FWIW, I think you're spot-on there.T.J. Crowder– T.J. Crowder2022年09月09日 10:26:09 +00:00Commented Sep 9, 2022 at 10:26
Unfortunately, there is an ongoing epidemic in which users (sometimes with a decent reputation) add/use Stack Snippets even when it's obvious that they never intended to present code that runs.
This is an uncomplicated case for which a suggestion to remove should clearly be accepted – and a suggestion to add should be rejected.
Here is
such an example
that I just edited.
For other cases, see this well-written answer.
You must log in to answer this question.
Explore related questions
See similar questions with these tags.
<img>
s with relative URLs that obviously 404 when on Stack Overflow, putting SCSS into the CSS section, and so on - and trust me, question askers manage to do them much more often than they manage to get it right. Meanwhile, there are swathes of suggested editors who will blindly turn (perfectly fine) non-snippet code blocks into blatantly broken snippets, and reviewers ready and willing to approve those edits.