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
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()); |
|
} |
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 wellI 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
--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:
pmd/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageProcessorRegistry.java
Lines 152 to 156 in 642716f
pmd/pmd-core/src/main/java/net/sourceforge/pmd/PmdAnalysis.java
Lines 213 to 218 in 642716f