# V3183. Code formatting implies that the statement should not be a part of the 'then' branch that belongs to the preceding 'if' statement.

The analyzer detected an instruction that belongs to an 'if' statement. However, the code formatting does not correspond with the logic of the code execution, so the code may contain an error.

Example:

    string GetArgumentPositionStr(Argument argument)
    {
      if (argument.first)
        return "first";

      if (argument.second)

      if (argument.third)
        return "third";

      return String.Empty;
    }

The example above lacks the 'then' branch for the 'if (argument.second)' conditional expression. That's why the incorrect code fragment works just as the following one:

    if (argument.second)
    {
      if (argument.third)
        return "third";
    }

The fixed code:

    string GetArgumentPositionStr(Argument argument)
    {
      if (argument.first)
        return "first";

      if (argument.second)
        return "second";

      if (argument.third)
        return "third";

      return String.Empty;
    }

This diagnostic is classified as:

CWE-670