Skip to content

Commit

Permalink
doc(supergroup): Fixed an issue with empty super group not defaulting…
Browse files Browse the repository at this point in the history
… correctly.
  • Loading branch information
taikuukaits committed Mar 19, 2020
1 parent d2a02c6 commit 278c0ea
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.tasks.TaskAction;
Expand Down Expand Up @@ -199,7 +200,7 @@ private void handleProperties(final TemplateProvider templateProvider, final Fil

final List<SimplePropertyTableGroup> simplePropertyTableData = new ArrayList<>();
for (final SplitGroup splitGroupOption : splitGroupOptions) {
if (!splitGroupOption.getSimple().isEmpty()) {
if (splitGroupOption.getSimple().isEmpty()) {
continue;
}

Expand Down Expand Up @@ -241,7 +242,13 @@ private Map<String, String> createSuperGroupLookup(final HelpJsonData helpJson)

helpJson.getOptions().forEach(option -> {
final String defaultSuperGroup = "Configuration";
final String superGroup = option.getSuperGroup().orElse(defaultSuperGroup);
final String rawSuperGroup = option.getSuperGroup().orElse("");
final String superGroup;
if (StringUtils.isBlank(rawSuperGroup)) {
superGroup = defaultSuperGroup;
} else {
superGroup = rawSuperGroup;
}

if (lookup.containsKey(option.getGroup()) && !superGroup.equals(lookup.get(option.getGroup()))) {
throw new RuntimeException(String.format("The created detect help JSON had a key '%s' whose super key '%s' did not match a different options super key in the same key '%s'.",
Expand Down

0 comments on commit 278c0ea

Please sign in to comment.