All Questions
Tagged with edits code-formatting
27 questions
6
votes
1
answer
98
views
code formatting lost after edit, revert would not fix it
I made an edit to this answer, (changed "unicode" to "str") however when I saved the edit, the code formatting was lost. I quickly reverted the edit, however the code formatting ...
-22
votes
2
answers
416
views
When is it OK to upload images of code/data/errors? [duplicate]
When is it OK to upload images of code/data/errors?
– If your answer is never, can we please talk about it?
Don't get me wrong.
I don't endorse uploading code/text in an image instead of uploading ...
-10
votes
1
answer
230
views
Are there any Stack Overflow rules regarding line indentation in formatted code?
... or in other words: Why would someone want to edit an answer just to remove four leading spaces of a few code lines?
Example: https://stackoverflow.com/revisions/73159227/5 - should I have known ...
2
votes
1
answer
110
views
Why was my code highlighting edit rejected?
I suggested an edit to a question's code block, from:
```import requests
...
to:
```python
import requests
...
This was a simple case of an asker writing unintended Markdown, and the edit fixed that....
68
votes
6
answers
2k
views
Should code be edited so that it is visible rather than being in one long line?
In many instances, I have seen code that is poorly formatted or all in one line (like below using R). Is it appropriate to edit the code so that it is more legible? I know in some instances these are ...
6
votes
0
answers
97
views
Existing answer detected as improperly formatted code while trying to edit
I'm trying to edit the regex community-wiki reference post, but any change I make gives me the error:
Your post appears to contain code that is not properly formatted as code. Please indent all code ...
26
votes
5
answers
2k
views
Why are posts edited to change the code formatting markers?
I have seen some edited posts, which have been edited to change the way that code is formatted. Sometimes, this is also the only edit they make.
It will be changed from four spaces indentation to ...
19
votes
3
answers
1k
views
Is a markup change enough improvement to be accepted as an edit?
Referring to the following suggested edit in the review queue: https://stackoverflow.com/review/suggested-edits/28302046
In case the suggested edit in question isn't accessible any longer, here it is ...
8
votes
0
answers
106
views
Edit shows expected code with a different format than what it really is
I'm using Google Chrome on Android 10 - Samsung Galaxy A30s.
When looking at this question
We can see the first code block has a specific indentation. Then, when clicking to edit
The expected result ...
-7
votes
2
answers
224
views
OP's question was erroneously edited. The moderators want to keep erroneous question as it looks 'pretty' and readable
I have a question about my Stack Overflow post: Truncate column names in SELECT (MySQL client)
The OP for a MySQL query (Truncate column names in SELECT (MySQL client)) had a problem with the ...
5
votes
1
answer
1k
views
How can we add a tab to every line?
So, many people mess up code fences in their questions. One of the most common errors is that one tab is missing at the beginning of every line. Example:
public class ExampleClass{
private void ...
5
votes
0
answers
118
views
Are edits that purely reformat code, based on preference, good edits?
Start note: This question is very similar to a question that was flagged as similar. Are purely cosmetic edits to original code frowned-upon, even if they accompany high-value non-code revisions? The ...
-2
votes
1
answer
132
views
Edit code where indentation is only one space?
I've read a couple of posts here and I came to the conclusion that you should not change the indentation style of a post. It's up to the poster to decide that. And that also includes how many spaces ...
2
votes
2
answers
114
views
Deal with edits that merely change indenting convention in code samples
There are so many coding conventions out there, in particular with regard to how much indenting to use. I don't think it makes any sense to discuss which one is easier to read in the same way as it ...
17
votes
2
answers
502
views
Should code formatting be used for package names?
It's clear enough that product names should not be formatted as code. What about package names? To me, this feels like a corner case not clearly addressed in When should code formatting be used for ...
8
votes
2
answers
141
views
Could preview display scrollbar in code format correctly?
When I write regular code snippets the preview shows a scrollbar when the number of lines > 36 it previews that there will be a scrollbar, while in fact, the scrollbar appears only after the number of ...
3
votes
3
answers
265
views
Is it OK to edit away boilerplate getters and setters from OP's original Java (& equivalent) code? [duplicate]
Usually - maybe more experienced - Stack Overflow users remove irrelevant/boilerplate getter/setter code from example code and add a comment like
// getters, setters
or as I do as a Lombok user by ...
21
votes
2
answers
433
views
Pure error message edit - how to react
I had yesterday somebody, who simply dumped his unformatted error message into the text body. When I tried to edit it, to make it at least comprehensible, SO didn't allow me to do this. I understand ...
2
votes
0
answers
64
views
Client-side Extension to Autoformat Code Snippets
Very often when a new question comes into Stack Overflow, it doesn't meet a certain quality bar. So if the question is salvageable, I take to editing it for clarity, formatting, grammar, etc.
...
51
votes
2
answers
1k
views
Cannot edit post due to code [duplicate]
I keep seeing these posts that are mostly code wrapped by a few lines of text, aforesaid code being formatted terribly. If I try to improve their post and edit the code I get the error:
it looks ...
1
vote
2
answers
118
views
How can I fix the VB comments and their formatting in questions that are tagged c#? [closed]
As soon as a VB comment is in a code sample, the rest of the code formatting is messed up until the next comment (if there is another one).
Should we add a policy to escape comments with ' so the ...
2
votes
1
answer
120
views
Should questions be edited to remove error-checking statements that dilute the code?
In C one should rigorously perform null-checks, however doing so obfuscates the rest of the code making it more difficult to review. Is it okay to remove such statements from an original post solely ...
6
votes
1
answer
107
views
Should snippets in questions be expanded so the code compiles even if the gist is understandable otherwise?
I've noticed several occasions where a nice clean code snippet in a question is edited by another user to transform the snippet into a working program.
The most recent example I noticed was this ...
2
votes
0
answers
53
views
Edits which only change coding conventions (like brace placement) [duplicate]
I've come across some edits that only change the coding conventions of the code in a post. Both are valid, widely-accepted conventions, both are well-formatted.
Why the edit then? And more to the ...
115
votes
5
answers
4k
views
When is it okay to edit posts for "Code Formatting?"
I recently posted this answer:
Continuing the most outer loop from the most nested one
It contains a block of Java code, written by me, currently under an edit war between myself and the original ...
7
votes
1
answer
93
views
What is the official stance on text wrapping edits?
If a question contains a code block that causes a lot of horizontal scrolling e.g:
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *...
86
votes
2
answers
8k
views
When should code formatting be used for non-code text?
I reviewed an edit that did no change to the post apart from introducing code formatting like this to words that aren't code, such as iOS and Android (while curiously leaving Delphi untouched). I didn'...