Repository: camel Updated Branches: refs/heads/master 5e67f4769 -> 1022e6a99
CAMEL-7999: Report components with missing javadoc Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1022e6a9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1022e6a9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1022e6a9 Branch: refs/heads/master Commit: 1022e6a993789aefd6a7b7559a8a1e7265dec8e5 Parents: 5e67f47 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Feb 6 10:17:57 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Feb 6 10:17:57 2015 +0100 ---------------------------------------------------------------------- .../maven/packaging/PrepareCatalogMojo.java | 24 +++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/1022e6a9/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java index aa2a0ec..4ad00c5 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java @@ -243,6 +243,7 @@ public class PrepareCatalogMojo extends AbstractMojo { Set<File> missingComponents = new TreeSet<File>(); Set<File> missingLabels = new TreeSet<File>(); Set<File> missingUriPaths = new TreeSet<File>(); + Set<File> missingJavaDoc = new TreeSet<File>(); Map<String, Set<String>> usedLabels = new TreeMap<String, Set<String>>(); // find all json files in components and camel-core @@ -327,6 +328,16 @@ public class PrepareCatalogMojo extends AbstractMojo { if (!text.contains("\"kind\": \"path\"")) { missingUriPaths.add(file); } + + // check all the properties if they have description + List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("properties", text, true); + for (Map<String, String> row : rows) { + String doc = row.get("description"); + if (doc == null || doc.isEmpty()) { + missingJavaDoc.add(file); + break; + } + } } catch (IOException e) { // ignore } @@ -359,7 +370,7 @@ public class PrepareCatalogMojo extends AbstractMojo { throw new MojoFailureException("Error writing to file " + all); } - printComponentsReport(jsonFiles, duplicateJsonFiles, missingComponents, missingUriPaths, missingLabels, usedLabels); + printComponentsReport(jsonFiles, duplicateJsonFiles, missingComponents, missingJavaDoc, missingUriPaths, missingLabels, usedLabels); } protected void executeDataFormats() throws MojoExecutionException, MojoFailureException { @@ -613,8 +624,8 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().info("================================================================================"); } - private void printComponentsReport(Set<File> json, Set<File> duplicate, Set<File> missing, Set<File> missingUriPaths, - Set<File> missingLabels, Map<String, Set<String>> usedLabels) { + private void printComponentsReport(Set<File> json, Set<File> duplicate, Set<File> missing, Set<File> missingJavaDoc, + Set<File> missingUriPaths, Set<File>missingLabels, Map<String, Set<String>> usedLabels) { getLog().info("================================================================================"); getLog().info(""); getLog().info("Camel component catalog report"); @@ -637,6 +648,13 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().warn("\t\t" + asComponentName(file)); } } + if (!missingJavaDoc.isEmpty()) { + getLog().info(""); + getLog().warn("\tMissing javadoc detected: " + missingJavaDoc.size()); + for (File file : missingJavaDoc) { + getLog().warn("\t\t" + asComponentName(file)); + } + } if (!usedLabels.isEmpty()) { getLog().info(""); getLog().info("\tUsed labels: " + usedLabels.size());