You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/01/30 09:17:11 UTC

[camel] branch master updated: camel-format-plugin to be less noisy

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 27ead32  camel-format-plugin to be less noisy
27ead32 is described below

commit 27ead325d7d2a4c21d0b683ce5bf1cbb01e6625b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 30 10:16:41 2021 +0100

    camel-format-plugin to be less noisy
---
 .../net/revelc/code/formatter/FormatterMojo.java   | 22 ++++++++++++----------
 parent/pom.xml                                     |  2 ++
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/init/camel-format-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java b/init/camel-format-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java
index b3d96dc..67a3908 100644
--- a/init/camel-format-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java
+++ b/init/camel-format-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java
@@ -386,13 +386,15 @@ public class FormatterMojo extends AbstractMojo implements ConfigurationSource {
                 storeFileHashCache(hashCache);
             }
 
-            long endClock = System.currentTimeMillis();
-
-            log.info("Successfully formatted:          " + rc.successCount + FILE_S);
-            log.info("Fail to format:                  " + rc.failCount + FILE_S);
-            log.info("Skipped:                         " + rc.skippedCount + FILE_S);
-            log.info("Read only skipped:               " + rc.readOnlyCount + FILE_S);
-            log.info("Approximate time taken:          " + ((endClock - startClock) / 1000) + "s");
+            // only output if we formatted something
+            if (rc.successCount > 0) {
+                log.info("Successfully formatted:          " + rc.successCount + FILE_S);
+                log.info("Fail to format:                  " + rc.failCount + FILE_S);
+                log.info("Skipped:                         " + rc.skippedCount + FILE_S);
+                log.info("Read only skipped:               " + rc.readOnlyCount + FILE_S);
+                long endClock = System.currentTimeMillis();
+                log.info("Approximate time taken:          " + ((endClock - startClock) / 1000) + "s");
+            }
         }
     }
 
@@ -557,14 +559,14 @@ public class FormatterMojo extends AbstractMojo implements ConfigurationSource {
             }
         } else if (file.getName().endsWith(".js") && jsFormatter.isInitialized()) {
             if (skipJsFormatting) {
-                getLog().info("Javascript formatting is skipped");
+                getLog().debug("Javascript formatting is skipped");
                 result = Result.SKIPPED;
             } else {
                 formattedCode = this.jsFormatter.formatFile(file, originalCode, this.lineEnding);
             }
         } else if (file.getName().endsWith(".html") && htmlFormatter.isInitialized()) {
             if (skipHtmlFormatting) {
-                getLog().info("Html formatting is skipped");
+                getLog().debug("Html formatting is skipped");
                 result = Result.SKIPPED;
             } else {
                 formattedCode = this.htmlFormatter.formatFile(file, originalCode, this.lineEnding);
@@ -585,7 +587,7 @@ public class FormatterMojo extends AbstractMojo implements ConfigurationSource {
             }
         } else if (file.getName().endsWith(".css") && cssFormatter.isInitialized()) {
             if (skipCssFormatting) {
-                getLog().info("css formatting is skipped");
+                getLog().debug("css formatting is skipped");
                 result = Result.SKIPPED;
             } else {
                 formattedCode = this.cssFormatter.formatFile(file, originalCode, this.lineEnding);
diff --git a/parent/pom.xml b/parent/pom.xml
index fd28cd3..152803b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -4128,7 +4128,9 @@
                     <configuration>
                         <configFile>camel-eclipse-formatter-config.xml</configFile>
                         <skip>${format.skip}</skip>
+                        <skipCssFormatting>true</skipCssFormatting>
                         <skipHtmlFormatting>true</skipHtmlFormatting>
+                        <skipJsFormatting>true</skipJsFormatting>
                         <cachedir>${basedir}/target</cachedir>
                         <excludes>${sourcecheckExcludes}</excludes>
                         <lineEnding>KEEP</lineEnding>