16

I have been asked to provide a "Minimal, Complete, and Verifiable example" (MCVE) in my question. What is this, and why should I include it?

14

When asking a question about a problem you will get much better answers if you provide steps or code people can use to reproduce the problem. Those steps should be:

  • Minimal – Use as little commands or code as possible that still produces the same problem.
  • Complete – Provide all parts needed to reproduce the problem.
  • Verifiable – Test the steps or code you're about to provide to make sure it reproduces the problem.

Minimal

The more commands or code there is to go through, the less likely people can find your problem. Streamline your example in one of two ways:

  1. Restart from scratch. Use an empty vimrc file, adding in only what is needed to see the problem. If your question is about VimScript or a macro, then make it as short as possible.

  2. Divide and conquer. When you have a small amount of code, but the source of the problem is entirely unclear, start removing code a bit at a time until the problem disappears – then add the last part back.

Complete

Make sure all information necessary to reproduce the problem is included:

  • Some people might be prepared to try your commands or code to test the answer they're about to post.

  • Provide the actual sample input that you're using. For example, when your problem is related to long lines, it's probably a good idea to include the actual long line that you're using; the problem might not be in the part you suspect it is, but another part entirely.

Verifiable

To help you solve your problem, others will need to verify that it exists:

  • Describe the problem. "It doesn't work" is not a problem statement. Tell us what the expected behaviour should be. Tell us what the exact wording of the error message is, and which line of code is producing it. Put a brief summary of the problem in the title of your question.

  • Ensure that the example actually reproduces the problem! If you inadvertently fixed the problem while composing the example but didn't test it again, you'd want to know that before asking someone else to help.

It might help to transport the example to a fresh machine to confirm it really does provide an example of the problem.


Note: this is a modified version of the Stack Overflow help page of the same name.

  • 1
    That's a really useful post! Plus creating such a MCVE is often a good way to debug your problem and solve it by yourself. – statox Mar 8 '16 at 12:27

You must log in to answer this question.

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