RAT-540: Create UI option collections#637
Conversation
bf4e7b0 to
e493553
Compare
37140e9 to
b93bc7f
Compare
|
@ottlinger, Once you finish this review I will rebase onto main to clean up the build errors. |
| try { | ||
| File includeFileName = context.getCommandLine().getParsedOptionValue(selected); | ||
| if (includeFileName != null) { | ||
| context.getConfiguration().addIncludedPatterns(ExclusionUtils.asIterable(includeFileName, "#")); |
There was a problem hiding this comment.
Description says "entries will be excluded from processing", but the method is "addIncludePatterns" - shouldn't it be "addExcludePatterns" then?
Most probably the description of the deprecated option is misleading ....
|
|
||
|
|
||
| private static void doNotExecute(final ArgumentContext context, final Option selected) { | ||
| throw new ImplementationException(String.format("'%s' should not be executed directly", selected)); |
There was a problem hiding this comment.
Initially I wondered "... what to do instead" is missing in that message to the user of RAT.
If I get this message, did I do something wrong or not?
In the case of "help-licenses" I used the option correctly ....
| context.getConfiguration().setStyleSheet(StyleSheets.getStyleSheet(style[0])); | ||
| } | ||
| private static void processOutputArgs(final ArgumentContext context, final UIOptionCollection<?> optionCollection) throws ConfigurationException { | ||
| for (Arg arg : new Arg[]{DRY_RUN, OUTPUT_FAMILIES, OUTPUT_LICENSES, OUTPUT_ARCHIVE, OUTPUT_STANDARD, OUTPUT_FILE, OUTPUT_STYLE}) { |
There was a problem hiding this comment.
Personally I'd prefer List.of() due to better readability than arrays here ....
| } catch (Exception e) { | ||
| throw ConfigurationException.from(e); | ||
| private static void processInputArgs(final ArgumentContext context, final UIOptionCollection<?> optionCollection) throws ConfigurationException { | ||
| for (Arg arg : new Arg[]{SOURCE, EXCLUDE, EXCLUDE_FILE, EXCLUDE_STD, EXCLUDE_PARSE_SCM, EXCLUDE_SIZE, |
There was a problem hiding this comment.
Personally I'd prefer List.of() due to better readability than arrays here ....
| }); | ||
| context.getConfiguration().setFrom(defaultBuilder.build()); | ||
|
|
||
| for (Arg arg : new Arg[]{FAMILIES_APPROVED, FAMILIES_APPROVED_FILE, FAMILIES_DENIED, FAMILIES_DENIED_FILE, |
There was a problem hiding this comment.
Personally I'd prefer List.of() due to better readability than arrays here ....
|
|
||
| import org.apache.rat.ui.UI; | ||
| import org.apache.rat.ui.UIOption; | ||
|
|
There was a problem hiding this comment.
Should we add a general description here that explains the proposed architecture?
| } | ||
|
|
||
| @OptionCollectionTest.TestFunction | ||
| @Override |
There was a problem hiding this comment.
The class contains many unused (reported by IDE) methods - is that part of the changes or can these methods be removed?
| <exclude>ALL</exclude> | ||
| </inputExcludeStds> | ||
| <inputIncludes>pom.xml</inputIncludes> | ||
| <inputExcludeStds>ALL</inputExcludeStds> |
There was a problem hiding this comment.
Should we document this breaking change in the change-notes for 1.0.0 explicitly?
| <configs> | ||
| <config>.rat/customConfig.xml</config> | ||
| </configs> | ||
| <inputExcludes>.rat/**</inputExcludes> |
There was a problem hiding this comment.
I'm not sure if this configuration is "Maven-style" - would it make sense to ask over at the Maven mailing list?
plugins contains multiple plugin-entries .... that made me think about this breaking change.
There was a problem hiding this comment.
What I mean is: how does a configuration with multiple entries look like?
<inputIncludes>
<include>pom.xml</include>
<include>foo.bar/include>
</inputIncludes>
OR will it become
<inputIncludes>pom.xml</inputIncludes>
<inputIncludes>foo.bar</inputIncludes>
| } | ||
|
|
||
| private AntDocumentation(final File outputDir) { | ||
| /* Visible for testing */ |
There was a problem hiding this comment.
Class contains unused methods:
- writeTitle
- writePara
- writeList
Should they be removed or will they be needed later and are only yet unused?
There was a problem hiding this comment.
As I recall, this class and methods will be used in the Ant UI package.
I wouldn't worry too much about tools as it goes away at the end of this trasformation.
In the end we will have the following modules
- core: (the core functionality)
- core test: test code from core packaged with dependencies to make it easier for UI modules. Basically a maven module that points to core
/src/testfor its/src/main. Jars built like this include dependencies so that when included as test libraries the transitive dependencies are present. - CLI: the current command line interface
- ANT: the ANT interface and components from tools that are used for it.
- Maven: the Maven interface and the components from tools that are used for it.
- packaging: -- Not sure about this one, but I think that it just puts outputs from the above modules into release (as in upload to sonatype or github release style) packages and deploys them.
The UI modules CLI, ANT, and Maven will have multiple sub modules. Something like
UI module pom
- tools: Tooling from current tool module + additional bits.
- main: The actual code that is released. Module should build the packaging necessary to use the UI as a stand alone unit
|
@ottlinger you have a number of good questions and ideas here with respect to how this works going forward. I like the idea of describing how the architecture works. Would you rather I fix/comment on the issues in this PR (and potentially make it larger) or open another PR to add the documentation. I had planned on writing/updating the general documentation (.md files) when this change is complete. |
|



Introduces
uipackageModifications to use
uipackage.Changes of note:
uipackage is new and contains all the UI classes that will be used to create new UIs. In future PRs the Ant and Maven UIs will be extracted and placed in separate modules.Fix for RAT-540