Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Language properties CLI surface syntax #2947

Open
6 tasks
oowekyala opened this issue Nov 27, 2020 · 2 comments
Open
6 tasks

[core] Language properties CLI surface syntax #2947

oowekyala opened this issue Nov 27, 2020 · 2 comments
Labels
an:enhancement An improvement on existing features / rules in:cli Affects the PMD Command Line Interface
Milestone

Comments

@oowekyala
Copy link
Member

oowekyala commented Nov 27, 2020

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 [vf] Provide expression type information to Visualforce rules to avoid false positives #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:

// TODO this should be reused when implementing the CLI
public static Map<Language, LanguagePropertyBundle> derivePropertiesFromStrings(
Map<Language, Properties> stringProperties,
PmdReporter reporter
) {

// TODO replace those with actual language properties when the
// CLI syntax is implemented.
props.setProperty(LanguagePropertyBundle.SUPPRESS_MARKER, config.getSuppressMarker());
if (props instanceof JvmLanguagePropertyBundle) {
((JvmLanguagePropertyBundle) props).setClassLoader(config.getClassLoader());
}

@oowekyala oowekyala added the an:enhancement An improvement on existing features / rules label Nov 27, 2020
@oowekyala oowekyala added this to the 6.31.0 milestone Nov 27, 2020
@oowekyala oowekyala added the in:cli Affects the PMD Command Line Interface label Nov 27, 2020
@adangel adangel modified the milestones: 6.31.0, 6.32.0 Jan 28, 2021
@adangel adangel modified the milestones: 6.32.0, 6.33.0 Feb 26, 2021
@oowekyala oowekyala modified the milestones: 6.33.0, 6.34.0 Mar 22, 2021
@adangel adangel modified the milestones: 6.34.0, 6.35.0 Apr 23, 2021
@oowekyala oowekyala modified the milestones: 6.35.0, 6.36.0 May 28, 2021
@adangel adangel modified the milestones: 6.36.0, 6.37.0 Jun 22, 2021
@adangel adangel modified the milestones: 6.37.0, 6.38.0 Jul 27, 2021
@adangel adangel modified the milestones: 6.38.0, 6.39.0 Aug 22, 2021
@adangel adangel modified the milestones: 6.39.0, 6.40.0 Sep 21, 2021
@adangel adangel modified the milestones: 6.40.0, 6.41.0 Oct 26, 2021
@adangel adangel modified the milestones: 6.41.0, 6.42.0 Nov 18, 2021
@adangel adangel modified the milestones: 6.42.0, 6.43.0 Jan 13, 2022
@adangel adangel modified the milestones: 6.43.0, 6.44.0 Feb 22, 2022
@adangel adangel removed this from the 6.44.0 milestone Mar 24, 2022
@adangel adangel added this to the 6.45.0 milestone Mar 24, 2022
@oowekyala oowekyala mentioned this issue Apr 7, 2022
55 tasks
@adangel adangel modified the milestones: 6.45.0, 6.46.0 Apr 28, 2022
@adangel adangel modified the milestones: 6.46.0, 6.47.0 May 19, 2022
@adangel adangel modified the milestones: 6.47.0, 6.48.0 Jun 21, 2022
@adangel adangel modified the milestones: 6.48.0, 6.49.0 Jul 26, 2022
@adangel adangel modified the milestones: 6.49.0, 6.50.0 Aug 30, 2022
@adangel adangel modified the milestones: 6.50.0, 6.51.0 Sep 30, 2022
@adangel adangel modified the milestones: 6.51.0, 6.52.0 Oct 25, 2022
@adangel adangel modified the milestones: 6.52.0, 6.53.0 Nov 22, 2022
@oowekyala oowekyala removed this from the 6.53.0 milestone Nov 22, 2022
@jsotuyod
Copy link
Member

I think beyond exposing this within the CLI (which is somewhat easy in PMD 7 with PicoCli, very similar to what was already done to expose and document renderer properties), we should probably think about having a pmd.properties file we pick up automatically from the current working directory if present (similar to what Gradle does with gradle.properties), where we allow both language and renderer properties to be set statically, and shared within a repository by a whole team if needed.

HEAPSIZE and PMD_JAVA_OPTS (currently taken from env vars by shell scripts) should probably be able to take these values from the properties file if present, while allowing env vars to override them.

@adangel
Copy link
Member

adangel commented Dec 1, 2022

@jsotuyod to give you a bit of context - in the last meeting we discussed whether this needs to be done before pmd7 and the conclusion was, it is not necessary. So, we removed it from the pmd6 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules in:cli Affects the PMD Command Line Interface
Projects
None yet
Development

No branches or pull requests

3 participants