#263 max-instatement-indent < 40 causes "Invalid option" error

Jim Pattee
4 days ago
Stefan H. Holek

Contrary to the docs, which state that values below 2*indent will be ignored, the max-instatement-indent check is hard-coded to < 40.


  • And why stop at 2 indents anyway? I can see value in setting this to 0 to get rid of all paren-aligning.

  • Index: AStyle/src/astyle_main.cpp
    --- AStyle/src/astyle_main.cpp  (revision 412)
    +++ AStyle/src/astyle_main.cpp  (working copy)
    @@ -2888,7 +2888,7 @@
            string maxIndentParam = getParam(arg, "M", "max-instatement-indent=");
            if (maxIndentParam.length() > 0)
                maxIndent = atoi(maxIndentParam.c_str());
    -       if (maxIndent < 40)
    +       if (maxIndent < 0)
                isOptionError(arg, errorInfo);
            else if (maxIndent > 120)
                isOptionError(arg, errorInfo);
  • Jim Pattee
    Jim Pattee

    The documentation is correct for the current release.

  • Jim Pattee
    Jim Pattee

    • status: open --> open-fixed
    • assigned_to: Jim Pattee
    • Priority: 5 --> 7
  • Jim Pattee
    Jim Pattee

    • Status: open-fixed --> closed-fixed
  • The docs state:

    Set the maximum of # spaces to indent a continuation line. The # indicates a number of columns and must not be greater than 120. If no # is set, the default value of 40 will be used. A maximum of less than two indent lengths will be ignored. This option will prevent continuation lines from extending too far to the right. Setting a larger value will allow the code to be extended further to the right.

    From the docs, it sounds like I should be able to set it to 4 columns. (40 is the default, but not the minimum) However, if I try to set --max-instatement-indent=4, I get:

    Invalid option file options:
    For help on options type 'astyle -h'
    Artistic Style has terminated

    I checked out the latest version of the source, and it is still hard coded to give an error if the value is less than 40. Source.

    Am I misunderstanding the documentation? Or are there plans already to fix this?

    Last edit: Benjamin R. Draut 4 days ago