Hot answers tagged

38

No Personally, I think that they should usually NOT be allowed for questions. This site is about code reviews. Readability is an important issue in code reviews, as are syntax errors. Editing the post is not constructive. It is much more helpful to leave a comment or answer that points out the shortcomings. If the code in the question is edited, other ...


23

I prefer to err on the side of commenting and closing, rather than fixing the code for them. Reasons include: Fixing broken code is a slippery slope. Newer users will see that and assume that editing code in questions is an acceptable practice, without understanding the general principle that code should remain unchanged. I'd prefer not to debate what ...


19

Stack Exchange in general has an English-Only policy. There are some exceptions for language-specific sites (like Stack Overflow in Portuguese). Code Review is not an 'exception' site. It is clear that there are benefits and drawbacks to having an English-only policy, but the Stack Exchange 'powers-that-be' have determined that, on balance, the English-only ...


17

If someone has bad use of newlines in their code, that should be pointed out in the code review. It doesn't make any sense to fix it for them. The whole point is to show them where their code could be improved, not to edit their code to fix it. Also, I don't agree that with your example, I prefer the first one. That's how the book I learned C++ from did it, ...


17

So questions must compile and work, in order to be considered on-topic questions. No. The code must compile and work in author's environment, so that OP isn't asking the CR community to fix their code, which would be Stack Overflow territory. But the code in the question itself doesn't need to compile straight out of the "ask question" box. Of course, if ...


15

Moderators have no restriction on edits that they can make. There is no technical reason that it would have had to go through a review, or be accepted. Additionally, there is no minimum edit restriction either, like there are for other users. So, aside from technical reasons to restrict the edit, was it a good one? I believe so, there was a spelling/typo ...


15

That's absolutely okay as there's no intentional answer invalidation involved. In order to keep out noise with this, you should just make the changes without adding in-post notes about these changes. They should only be in the edit summary. When doing this, however, be wary that someone may already be in the process of typing an answer that could include ...


15

In general you shouldn't be editing code in the question, but instead reviewing it. But there are at least two cases where it's fine to make an exception: Where the poster has fumbled the formatting. See for example this question, where the poster didn't know how to follow a numbered list with a code block. It's fine to fix this kind of mistake. Where ...


14

Two scenarios: I just posted, and found a bug seconds after. Leave a comment on your post to that effect (in case anyone is currently in the process of writing an answer), and then ninja-edit the fix into the post. If you do it within the 5-minute grace period, it won't even leave a trace in the revision history. Then delete the comment, and nobody will ...


14

I believe this is more a matter of personal preference than anything else. Personally I tend to use ### (h3 in HTML) for headers, but I am fine with other people choosing anything else. This is something that should not be any "site policy" or "site recommendation", we have enough of those as it is.


13

Unlike Stack Overflow, at Code Review we are interested not only in a solution that works, but a solution that is well expressed as code. Therefore, we review all facets of the code, including whitespace. If you feel that the code in the question is improperly formatted, do not silently edit the question, but rather write an answer that addresses the ...


13

I think it would be inappropriate to change headers into bold text. For one thing, it's a trivial edit — if it were a suggested edit, would it really be worth +2 and bothering other users to review that change? For another, changing semantic markup to non-semantic markup just to get the look you personally prefer is bad practice. If you have a complaint ...


13

The state of the question as seen in https://codereview.stackexchange.com/revisions/214917/6 (before my rollback) literally says "In response to Peter Taylor's answer". It makes the question confusing, as you can no longer read from top to bottom. You instead read: Question, response to answer, answer. The response to the answer would work better in ...


12

Sure you can edit your question/code if there are no answers. Just don't place alternative code-junks without adding the comperative-review tag. Replacing the code in question is fine without tagging it. If one is doing a review at the same moment he/she will maybe place a comment asking when you will be finished (I did so on another question). If you see ...


11

Your instincts are good. The question was off-topic because the code did not work. Therefore, the only way to make it on-topic would be to edit the code, which is forbidden. (Well, you could also relax the goal of the code to declare that it "works", but I don't see how that is possible in this case.) Note that if you were to fix the code, it would cease to ...


11

All languages have a name, and when talking about that language, it's official name should be used. For example, it's “Java“ and not “JAVA”. Sometimes, the name of a language is the same as name of the primary implementation. For example, the system's sed implementation is usually called sed while AWK's interpreter is called awk. Here, capitalization can ...


11

The Edit Review queue is notorious for people making mistakes in the process. The problem is almost entirely related to the fact that answer edits are much rarer than question edits. Code Review has unfortunately got a lot of robo-reviewers in this queue, people who see a code edit - and auto-reject - without first checking whether the code is part of an ...


11

Let's try adressing the questions first and then some more general stuff: Why did I not get a notification that my question received and edit? This MSE post suggests that edits need to meet certain criteria to trigger a notification. You should have received a notification for the change in title. Although no constexpr tag exist, this is the single ...


11

This specific case is a bit unusual in that the edit was "suggested" by a user with the same username as the original author. Note also that the original author's account is unregistered, which unfortunately makes it really easy to lose access to the account. Unregistered users are basically identified through their cookies making it impossible to use that ...


10

First, if you're unsure, you should skip it, that's exactly what the button is for. For this specific edit, my personal opinion is that it should be rejected. I think edits on CR answers are useful when they are relatively small, unambiguous improvements, not rewriting a significant part of the code in the answer. I think posting a separate answer would be ...


10

I don't think this would quite work. For one thing, it could be abused by anyone looking to edit in malicious content behind the scenes (although you can maybe argue that new users cannot have access to this). This feature is also in place to help ensure that edited posts are seen, so that it's easier for others to assess those changes. As a frequent ...


10

Let's get one thing straight: There's no such thing as 'too minor' edit anymore. When approving or rejecting edits, there used to be a "too minor" reason for rejection. This reason does not exist anymore. Additionally, 1k+ users do not need to have their edits approved.


10

What would really help is if all these "well intentioned" edits were filtered through review queues instead as people learn.... unfortunately, that threshold for people is still with beta-level reputation levels, so that filter is not as useful as it should be. On the other hand, this is a perceived problem that may not in fact happen (we would have to "...


10

I do agree with @200_success that it was better left as a comment. I don't feel that even something like #include should be added to the question by someone else. I would assume that the OP was already aware of #includes for his/her local code (you'd have to be a super beginner to not know about using the most basic ones) but felt that it wasn't necessary ...


10

Disclaimer: I use H3 headers all the time I agree that gigantic headers don't look good. But we might disagree on where we draw the line on what is "gigantic". As @200_success wrote in his answer, the important point is to use semantic markup. Strong markup is not for headers. We should use markup designed for headers. But which semantic header should we ...


10

There's no unwritten rule for that, no. People (me included) edit answers to improve formatting all the time, here or anywhere else on SE - there's even incentives (imaginary Internet points!) for doing it! If you disagree with an edit on your post, you can roll it back and, in the comment section under your answer, you can @ping the editor and explain ...


10

Thank you for revising the question — Rev 5 is much better as a Code Review question than the original. That said, I hesitate to reopen it, because I'm not 100% sure I understand what you are trying to accomplish with this code. Why are you calling the function as change_object_using_path_string("example_object", …) rather than ...


9

Use blockquotes for blockquotes. Use headers for headers. There is no guarantee that blockquotes will look like nice headers on all Stack Exchange interfaces, including the desktop, mobile, and Android/iOS apps. Furthermore, we expect the site to be redesigned soon for graduation, and blockquote rendering may change. In fact, now might be a good time to ...


9

No. Do not edit. First of all, that this question is cross-posted to Stack Overflow is irrelevant. The only time the code in a Code Review question should be edited is if it is clear that something went wrong when the original asker was copy & pasting from their IDE. You might make a case for duplicating the edits from Stack Overflow if, and only if ...


9

Your solution is to tell the OP what he should be doing. Don't do things based on assumptions of intent. If the OP cares enough to post here, and genuinely wants a review, he should also care enough to adjust accordingly; ensuring his question is clear and on topic. if OP isn't invested enough to pay this small cost of admission, it's even less of a reason ...


Only top voted, non community-wiki answers of a minimum length are eligible