Skip to content

Commit

Permalink
feedback BenjaminAmos, main class used.
Browse files Browse the repository at this point in the history
  • Loading branch information
soloturn committed Dec 9, 2023
1 parent 3746d05 commit 8f08b52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* Enumerates all classes and packages that are annotated with {@link API}.
*/
@SuppressWarnings("PMD.SystemPrintln") // main entrypoint used to generate documentation
public final class ApiScraper {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiScraper.class);

Expand Down Expand Up @@ -62,18 +63,18 @@ public static void main(String[] args) throws Exception {

// Find out what jar it came from and consider that the category
String categoryFragment = location.getPath();
LOGGER.debug("category fragment as path: {}", categoryFragment);
//System.out.println("category fragment as path: " + categoryFragment);
int bang = categoryFragment.lastIndexOf("!");
int hyphen = categoryFragment.lastIndexOf("-", bang);
int slash = categoryFragment.lastIndexOf("/", hyphen);
category = categoryFragment.substring(slash + 1, hyphen);
LOGGER.debug("category fragment pared down: {}", category);
//System.out.println("category fragment pared down: " + category);

if (isPackage) {
LOGGER.debug("Jar-based Package: {}, came from {}", apiPackage, location);
//System.out.println("Jar-based Package: " + apiPackage + ", came from " + location);
sortedApi.put(category, apiPackage + " (PACKAGE)");
} else {
LOGGER.debug("Jar-based Class: {}, came from {}", apiClass, location);
//System.out.println("Jar-based Class: " + apiClass + ", came from " + location);
sortedApi.put(category, apiClass.getName() + (apiClass.isInterface() ? " (INTERFACE)" : " (CLASS)"));
}

Expand All @@ -85,10 +86,10 @@ public static void main(String[] args) throws Exception {
category = "terasology engine";

if (isPackage) {
LOGGER.debug("Local Package: {}, came from {}", apiPackage, location);
//System.out.println("Local Package: " + apiPackage + ", came from " + location);
sortedApi.put(category, apiPackage + " (PACKAGE)");
} else {
LOGGER.debug("Local Class: {}, came from {}", apiClass, location);
//System.out.println("Local Class: " + apiClass + ", came from " + location);
sortedApi.put(category, apiClass.getName() + (apiClass.isInterface() ? " (INTERFACE)" : " (CLASS)"));
}

Expand All @@ -103,13 +104,13 @@ public static void main(String[] args) throws Exception {
sortedApi.putAll("external", ExternalApiWhitelist.PACKAGES.stream()
.map(packagee -> packagee + " (PACKAGE)").collect(Collectors.toSet()));

LOGGER.info("# Modding API:\n");
System.out.println("# Modding API:\n");
for (String key : sortedApi.keySet()) {
LOGGER.info("## " + key + "\n");
System.out.println("## " + key + "\n");
for (String value : sortedApi.get(key)) {
LOGGER.info("* {}", value);
System.out.println("* " + value);
}
LOGGER.info("");
System.out.println("");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* Enumerates all default key bindings and writes them sorted by ID to the console
*/
@SuppressWarnings("PMD.SystemPrintln") // main entrypoint used to generate documentation
public final class BindingScraper {
private static final Logger LOGGER = LoggerFactory.getLogger(BindingScraper.class);

Expand Down Expand Up @@ -89,10 +90,10 @@ public static void main(String[] args) throws Exception {
}

for (InputCategory row : categories.keySet()) {
LOGGER.info("# {}", row.displayName());
System.out.println("# " + row.displayName());

categories.get(row).stream().filter(entry -> entry != null).forEach(entry ->
LOGGER.info("{}: {}", desc.get(entry), keys.get(entry)));
System.out.println(desc.get(entry) + ": " + keys.get(entry)));
}
}

Expand Down

0 comments on commit 8f08b52

Please sign in to comment.