pmd / pmd/pmd

[core] Language properties CLI surface syntax

Open
#2,947 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

an:enhancement in:cli
Dominant language
Java
Stars
5.5k
Forks
1.6k
Avg merge
1d 19h
Merged PRs (30d)
54

Description

This is about the part of #2518 that could be targeted to master (6.31.0) to accompany #2864

This ticket is just about to add this form of argument to the cli: -L<langId>:<propName> <value>, or some form of this depending on what JCommander supports well

I don't think we should aim to implement the data flow from the command-line arg parsing to the language instance in this ticket. It's probably difficult to do on master, easier on the 7.0 branch, and will stay alive longer on that branch. So this part is still in #2518

Instead, what #2864, and #2830 do is to add attributes to the ParserOptions, as this is what parsers get as their input. Linking the CLI to the ParserOptions can be done with a system property as a swap, which is mostly already implemented in #2864 I think

TODO

  • Find out a satisfying syntax with JCommander and implement it (based on #2864)
  • Document
    • on the website CLI reference
    • we probably need some new page that explains language by language what sets them apart (which language versions, which properties, other details or useful info for people writing rules maybe, and stuff like links to javadoc)
    • in the release notes
    • in the CLI --help?

This should probably be prominently marked experimental everywhere it is mentioned for at least a few releases, maybe even until PMD 7. But the api surface is I think quite small since it's just one form of arguments.

I think this task could shave a big chunk off #2518, because the user documentation will probably not need to change too much

See also:

https://github.com/pmd/pmd/blob/642716fabf985d4ca53043d86164a41083af93ab/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageProcessorRegistry.java#L152-L156

https://github.com/pmd/pmd/blob/642716fabf985d4ca53043d86164a41083af93ab/pmd-core/src/main/java/net/sourceforge/pmd/PmdAnalysis.java#L213-L218

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cited sections of pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageProcessorRegistry.java and pmd-core/src/main/java/net/sourceforge/pmd/PmdAnalysis.java, then inspect #2864 and JCommander’s supported argument forms. Define and implement the CLI syntax only, without the language-instance data flow. Document the experimental feature in the website CLI reference, release notes, and possibly CLI help.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.