0
\$\begingroup\$

There are times when I have written code that looks insane when I step back from it. It is during those times where I might need a sanity check. So, is asking for a sanity check allowed?

For example, I have two for loops iterating over the same list to create two arrays. Is it sane to keep the loops separate, or should I merge them into one loop?

Sanity checks are for code that works but may look weird or strange to the author. Sometimes an author may just need a virtual hug.

| |
\$\endgroup\$
  • 2
    \$\begingroup\$ Can you define what a sanity check is? \$\endgroup\$ – Peilonrayz Jul 12 at 13:46
  • \$\begingroup\$ Should I put the example in the post? \$\endgroup\$ – Lady Aleena Jul 12 at 13:48
  • 2
    \$\begingroup\$ Yes. An example and an explanation of what a sanity check is would probably help. \$\endgroup\$ – Peilonrayz Jul 12 at 13:49
  • \$\begingroup\$ An example and explanation are added. \$\endgroup\$ – Lady Aleena Jul 12 at 14:01
  • 1
    \$\begingroup\$ From what I can tell in itself a sanity check would be on-topic, but it's much more likely that you get more than you bargained for around here. It's also likely that posting here requires a comparatively high effort for just a quick sanity check. It's probably much more helpful to find a coworker or friend to have a quick look if all you want is a sanity check... \$\endgroup\$ – Vogel612 Jul 12 at 14:26
  • \$\begingroup\$ My friends don't know perl, and I don't have a job. I am used to waiting for sanity checks. \$\endgroup\$ – Lady Aleena Jul 12 at 22:32
3
\$\begingroup\$

On-topic

Please ensure that:

  1. The code works the way that you want it to.
  2. Have the relevant code in the question.
  3. Have provided enough code that we can actually give genuine feedback.
  4. Explained the code in the body of the question.
  5. Have a title that is a short summary of the code.

For example, I have two for loops iterating over the same list to create two arrays. Is it sane to keep the loops separate, or should I merge them into one loop?

If this is the example question then:

  1. ✔️
  2. ❌ We have not got the code.
  3. ✔️/❌ Depending on the code, make sure you provide the code as is.
  4. ❌ You have not explained what the code is creating or why the code is creating it.
| |
\$\endgroup\$
  • \$\begingroup\$ If I were to post a sanity check, the working code will be included. The "example" would be a question relevant to the included working code. The code would be explained in as much detail as possible. Code wasn't included in my question here since I didn't want THIS question to turn into help with the code. Code will be included in my posts in Main Code Review. \$\endgroup\$ – Lady Aleena Jul 25 at 17:14

You must log in to answer this question.

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