camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-8251: Add to catalog report which eips has missing javadoc still.
Date Fri, 16 Jan 2015 13:40:27 GMT
Repository: camel
Updated Branches:
  refs/heads/master b3385d0d1 -> ed166443d


CAMEL-8251: Add to catalog report which eips has missing javadoc still.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ed166443
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ed166443
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ed166443

Branch: refs/heads/master
Commit: ed166443d98ff671fc1a08b3370c492d67f9ee2f
Parents: b3385d0
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jan 16 14:40:19 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jan 16 14:40:19 2015 +0100

----------------------------------------------------------------------
 .../maven/packaging/PrepareCatalogMojo.java     | 30 ++++++++++++++++++--
 1 file changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ed166443/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 934e800..58d07dc 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
@@ -133,6 +133,7 @@ public class PrepareCatalogMojo extends AbstractMojo {
         Set<File> jsonFiles = new TreeSet<File>();
         Set<File> duplicateJsonFiles = new TreeSet<File>();
         Set<File> missingLabels = new TreeSet<File>();
+        Set<File> missingJavaDoc = new TreeSet<File>();
         Map<String, Set<String>> usedLabels = new TreeMap<String, Set<String>>();
 
         // find all json files in camel-core
@@ -158,8 +159,8 @@ public class PrepareCatalogMojo extends AbstractMojo {
                 throw new MojoFailureException("Cannot copy file from " + file + " ->
" + to, e);
             }
 
-            // check if we have a label as we want the eip to include labels
             try {
+                // check if we have a label as we want the eip to include labels
                 String text = loadText(new FileInputStream(file));
                 // just do a basic label check
                 if (text.contains("\"label\": \"\"")) {
@@ -181,6 +182,22 @@ public class PrepareCatalogMojo extends AbstractMojo {
                         }
                     }
                 }
+
+                // 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 name = row.get("name");
+                    // skip checking these as they have no documentation
+                    if ("expression".equals(name) || "outputs".equals(name)) {
+                        continue;
+                    }
+
+                    String doc = row.get("description");
+                    if (doc == null || doc.isEmpty()) {
+                        missingJavaDoc.add(file);
+                        break;
+                    }
+                }
             } catch (IOException e) {
                 // ignore
             }
@@ -213,7 +230,7 @@ public class PrepareCatalogMojo extends AbstractMojo {
             throw new MojoFailureException("Error writing to file " + all);
         }
 
-        printModelsReport(jsonFiles, duplicateJsonFiles, missingLabels, usedLabels);
+        printModelsReport(jsonFiles, duplicateJsonFiles, missingLabels, usedLabels, missingJavaDoc);
     }
 
     protected void executeComponents() throws MojoExecutionException, MojoFailureException
{
@@ -551,7 +568,7 @@ public class PrepareCatalogMojo extends AbstractMojo {
         printLanguagesReport(jsonFiles, duplicateJsonFiles, missingLabels, usedLabels);
     }
 
-    private void printModelsReport(Set<File> json, Set<File> duplicate, Set<File>
missingLabels, Map<String, Set<String>> usedLabels) {
+    private void printModelsReport(Set<File> json, Set<File> duplicate, Set<File>
missingLabels, Map<String, Set<String>> usedLabels, Set<File> missingJavaDoc)
{
         getLog().info("================================================================================");
 
         getLog().info("");
@@ -585,6 +602,13 @@ public class PrepareCatalogMojo extends AbstractMojo {
                 }
             }
         }
+        if (!missingJavaDoc.isEmpty()) {
+            getLog().info("");
+            getLog().warn("\tMissing javadoc on models: " + missingJavaDoc.size());
+            for (File file : missingJavaDoc) {
+                getLog().warn("\t\t" + asComponentName(file));
+            }
+        }
         getLog().info("");
         getLog().info("================================================================================");
     }


Mime
View raw message