Skip to content

[core] JCommander's help text for option -min is wrong  #1145

@oowekyala

Description

@oowekyala

Affects PMD version: 6.3.0

The -min CLI option (rule priority threshold) takes an integer argument between 1 and 5. However, JCommander assumes it's an enum and displays the following help:

  -minimumpriority, -min
       Rule priority threshold; rules with lower priority than configured here
       won't be used. Default is '5' which is the lowest priority.
       Default: Low
       Possible Values: [High, Medium High, Medium, Medium Low, Low]

Using the name of an enum constant makes the parameter parsing fail:

https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java#L132

Should we allow mentioning the names of the constants? Or just fix the JCommander help?

For some reason, only -min 4 and -min 5 work as expected (at least on my machine). Using eg -min 3 makes PMD fail with

GRAVE: No rules found. Maybe you mispelled a rule name? (/home/clifrr/Bureau/import_sample/rset.xml)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions