Skip to content

FormatString bug in AutoComplete found by Error Prone #2053

@vorburger

Description

@vorburger

I'm running https://errorprone.info/ on this project, and it claims to have found a bug:

picocli/src/main/java/picocli/AutoComplete.java:788 : error: [FormatString] extra format arguments: used 2, provided 3
                buff.append(format("%s      positionals=$( compReplyArray \"${%s_pos_param_args[@]}\" )\n", indent, paramName, currWord));

picocli/src/main/java/picocli/AutoComplete.java:832 : error: [FormatString] extra format arguments: used 2, provided 3
                buff.append(format("%s      COMPREPLY=( $( compReplyArray \"${%s_option_args[@]}\" ) )\n", indent, bashify(option.paramLabel()), currWord));

See https://errorprone.info/bugpattern/FormatString ... @remkop from a quick glance, I think this is a real bug, not a false positive? As far as I understand it in both of those cases there are indeed only x2 %s but 3 arguments.

I would by happy to send a CL, but it's not immediately clear to me which of the 3 is wrong and should be removed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions