Skip to content

[core] Migrate CLI to using GNU-style long options #3424

@oowekyala

Description

@oowekyala

Is your feature request related to a problem? Please describe.
Currently our CLI uses ugly BSD-style options (long options with a single dash). Using a double dash for long options is more usual in modern programs (this is "GNU style"). Also our names are inconsistent,

  • eg -failOnViolation also has the variant --failOnViolation as synonym, but it's the only option that does
  • eg we use inconsistent word splitting conventions throughout, eg failOnViolation is camel case, -norulesetcompatibility is "clump-together case" as far as I'm concerned, while -no-cache is in the more usual style for long CLI options

Describe the solution you'd like

  • Add long variants for all our CLI options that
    • are GNU style (--)
    • use a consistent casing convention, eg --fail-on-violation, --no-ruleset-compatibility
  • Output a deprecation warning when the old variants are used.
  • Remove the old variants in PMD 7

Additional thoughts:

  • -version should NOT be renamed to --version. As per the gnu standards, the --version option should instead print the version of PMD. I suggest renaming it to --use-version.
  • CPD uses GNU style options and mostly uses --this-style but --failOnViolation is camel case and could also be updated
  • I'm not sure if we should rename --filelist to --file-list. It feels like a single word now with a specialized meaning, but I'm not sure that's the case

Metadata

Metadata

Assignees

Labels

an:enhancementAn improvement on existing features / rulesin:cliAffects the PMD Command Line Interface

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