4

With respect to this question, Need help with wire connections and code, I feel sorry for the OP, as their code's indentation seems to get worse at each edit iteration.

There are obvious code errors in the sketch (one of which I pointed out in my answer). However, it's impossible to follow the code now as a lot of indentation has been removed, and I gave up trying.

I thought about fixing the indentation in the question, for the OP, but I stopped myself. However, I've seen that Majenko, on occasion, has submitted an answer (i.e. here), with the code correctly indented, rather than fixing indentation of the code in the question, and without actually correcting the code errors, but pointing them out instead, for the OP to fix.

Is that what I should do in this case (or rather, would that be an acceptable answer)? Or should I fix the indentation in the question itself?

I really only want to just fix the indentation and have it posted somewhere - hopefully after that the error will be a lot more obvious to point out.

1
  • 4
    In my opinion, it is acceptable to edit the question to adjust what amounts to the whitespace of poorly formatted code, so long as the actual function is not changed (so as not to corrupt the question as asked). This has the benefit of helping those who come along later and find the question -- so they may be able to understand whether or not it helps them. Commented Apr 23, 2019 at 13:04

2 Answers 2

5

I don't believe there is any problem at all in editing a question to improve it. If you weren't supposed to do that, there wouldn't be that privilege. See:

Help Center > Privileges > edit questions and answers

What is edit questions and answers?

We believe in the power of community editing. That means once you've generated enough reputation, we trust you to edit anything in the system without it going through peer review. Not just your posts— anyone's posts!

When should I edit posts?

Any time you feel you can make the post better, and are inclined to do so. Editing is encouraged!

Some common reasons to edit are:

  • to fix grammatical or spelling mistakes
  • to clarify the meaning of a post without changing it
  • to correct minor mistakes or add addendums / updates as the post ages
  • to add related resources or hyperlinks

So that is pretty clear that tidying up a question is not only OK, it is encouraged! New posters may not realize how to format code, for example. So rather than ticking them off, you can improve it for them, maybe posting a comment underneath explaining how you did that, to help them for next time.


As for the specific whitespace issue, sometimes I copy code, run it through the IDE auto-format, and paste it back. The more readable the code is, the easier to fix bugs! You could, again, explain how you did that, and why it helps.

2
  • Thanks Nick. I hope that it didn't come across as if I were ticking them off. I think that at the time, I had just got exasperated that their edits had regressed the formatting that I had already done. auto-format, well there's a menu item that I had never ever noticed before - excellent, that is much more efficient. As they say, you learn something new every day :-) Commented Apr 24, 2019 at 10:16
  • 1
    @Greenonline - I'm not suggesting that you were ticking anyone off. I think it is useful, as far as possible :) when replying to, or commenting on, posts to help the poster improve their posts. This answer was intended to be more general than just be addressed to you. These meta posts will persist into the future.
    – Nick Gammon Mod
    Commented Apr 24, 2019 at 12:08
2

I believe the OP should be notified (eg through a comment) that the indenting has been fixed and how they can do that easily in the IDE.

As jose can u c said;

In my opinion, it is acceptable to edit the question to adjust what amounts to the whitespace of poorly formatted code, so long as the actual function is not changed (so as not to corrupt the question as asked). This has the benefit of helping those who come along later and find the question -- so they may be able to understand whether or not it helps them.

Clearly, fixing the brace problem would have corrupted the question asked, but fixing whitespace does not.

We are volunteers and anything that can save you and me time in answering is welcome - as long as it doesn't change/corrupt the problem.

You must log in to answer this question.

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