Alissa Bonas has uploaded a new change for review.

Change subject: engine: add checkstyle rule UncommentedMain
......................................................................

engine: add checkstyle rule UncommentedMain

Enable the rule, remove unused main methods
and suppress the validation for classes where the main method is needed.

Change-Id: Ife8c381ec290214da66cb3df2aa3f29b7c57af98
Signed-off-by: Alissa Bonas <[email protected]>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/CLIParser.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/KrbConfCreator.java
M build-tools-root/checkstyles/src/main/resources/checkstyle-suppressions.xml
M build-tools-root/checkstyles/src/main/resources/checkstyle.xml
4 files changed, 5 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/23008/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/CLIParser.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/CLIParser.java
index 0bcb8d1..897d738 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/CLIParser.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/CLIParser.java
@@ -33,18 +33,4 @@
         return argsMap.keySet();
     }
 
-    public static void main(String[] args) {
-        CLIParser parser = new CLIParser(args);
-        if (args.length == 0) {
-            System.out.println("Usage:\n\t-d or -flag an existance flag that 
can be checked with hasArg(String) method"
-                    + "\n\t-key=value value can be extracted with 
getArg(String) method");
-            System.exit(1);
-        }
-
-        System.out.println("arguments sent:\n");
-        for (String key : parser.getArgs()) {
-            String value = parser.getArg(key);
-            System.out.println(" " + key + ": " + value);
-        }
-    }
 }
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/KrbConfCreator.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/KrbConfCreator.java
index 83e3495..f0eb7d0 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/KrbConfCreator.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/KrbConfCreator.java
@@ -219,20 +219,6 @@
         return (realm != null) ? " Problematic domain is: " + 
realm.toLowerCase() : "";
     }
 
-    public static void main(String[] args) throws FileNotFoundException {
-        try {
-            KrbConfCreator kerbParser = new KrbConfCreator(args);
-            StringBuffer buffer = kerbParser.parse();
-            kerbParser.toFile(buffer);
-        } catch (Exception e) {
-            System.out.println("Error: " + e.getMessage());
-            if (e instanceof AuthenticationException) {
-                System.exit(((AuthenticationException) 
e).getAuthResult().getExitCode());
-            }
-            System.exit(1);
-        }
-    }
-
     private enum Arguments {
         domains,
         krb5_conf_path,
diff --git 
a/build-tools-root/checkstyles/src/main/resources/checkstyle-suppressions.xml 
b/build-tools-root/checkstyles/src/main/resources/checkstyle-suppressions.xml
index 037ea10..a15dad2 100644
--- 
a/build-tools-root/checkstyles/src/main/resources/checkstyle-suppressions.xml
+++ 
b/build-tools-root/checkstyles/src/main/resources/checkstyle-suppressions.xml
@@ -9,4 +9,8 @@
     <suppress checks="checks.NoArgConstructorCheck" files="EventResult.java"/>
     <suppress checks="checks.NoArgConstructorCheck" files="LocationInfo.java"/>
     <suppress checks="checks.NoArgConstructorCheck" 
files="HttpLocationInfo.java"/>
+    <suppress checks="UncommentedMain" files="ManageDomains.java"/>
+    <suppress checks="UncommentedMain" files="Notifier.java"/>
+    <suppress checks="UncommentedMain" files="Tar.java"/>
+    <suppress checks="UncommentedMain" files="TestCommon.java"/>
 </suppressions>
\ No newline at end of file
diff --git a/build-tools-root/checkstyles/src/main/resources/checkstyle.xml 
b/build-tools-root/checkstyles/src/main/resources/checkstyle.xml
index fcb590a..4ad86dc 100644
--- a/build-tools-root/checkstyles/src/main/resources/checkstyle.xml
+++ b/build-tools-root/checkstyles/src/main/resources/checkstyle.xml
@@ -20,6 +20,7 @@
     <module name="AvoidStarImport"/>
     <module name="UpperEll"/>
     <module name="EqualsHashCode"/>
+    <module name="UncommentedMain"/>
     <module name="checks.NlsCheck">
       <property name="run" value="${runNlsCheck}" default="false"/>
     </module>


-- 
To view, visit http://gerrit.ovirt.org/23008
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife8c381ec290214da66cb3df2aa3f29b7c57af98
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alissa Bonas <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to