Explorar el Código

Remove unused verbosity options.

Timur Sağlam hace 5 años
padre
commit
39290c6694

+ 2 - 4
README.md

@@ -48,11 +48,9 @@ Usage: JPlag [ options ] [<root-dir>]
 
 named arguments:
   -h, --help             show this help message and exit
-  -l {java1,java2,java5,java5dm,java7,java9,python3,cpp,csharp,char,text,scheme}
-                         Select the language to parse the submissions (Standard: java9)
+  -l                     {java1,java2,java5,java5dm,java7,java9,python3,cpp,csharp,char,text,scheme} Select the language to parse the submissions (Standard: java9)
   -bc BC                 Name of the directory which contains the base code (common framework used in all submissions)
-  -v {parser,quiet,long,details}
-                         Verbosity (Standard: quiet)
+  -v                     {quiet,long} Verbosity of the logging (Standard: quiet)
   -d                     (Debug) parser. Non-parsable files will be stored (Standard: false)
   -S S                   Look in directories <root-dir>/*/<dir> for programs
   -p P                   comma-separated list of all filename suffixes that are included

+ 1 - 1
jplag.frontend.java-1.7/src/test/java/jplag/StrippedProgram.java

@@ -16,7 +16,7 @@ public class StrippedProgram implements ProgramI {
         } else if (normalMsg != null) {
             System.out.println(normalMsg);
         } else {
-            System.out.println("Someboy messed up - no message given");
+            System.out.println("Somebody messed up - no message given");
         }
     }
 }

+ 5 - 19
jplag/src/main/java/jplag/JPlag.java

@@ -1,7 +1,6 @@
 package jplag;
 
 import static jplag.options.Verbosity.LONG;
-import static jplag.options.Verbosity.PARSER;
 import static jplag.options.Verbosity.QUIET;
 
 import java.io.BufferedReader;
@@ -19,6 +18,7 @@ import java.util.stream.Collectors;
 
 import jplag.options.JPlagOptions;
 import jplag.options.LanguageOption;
+import jplag.options.Verbosity;
 import jplag.strategy.ComparisonStrategy;
 import jplag.strategy.NormalComparisonStrategy;
 import jplag.strategy.ParallelComparisonStrategy;
@@ -135,28 +135,14 @@ public class JPlag implements ProgramI {
 
     @Override
     public void print(String message, String longMessage) {
-        if (options.getVerbosity() == PARSER) {
-            if (longMessage != null) {
-                System.out.println(longMessage);
-            } else if (message != null) {
-                System.out.println(message);
-            }
-        }
-        if (options.getVerbosity() == QUIET) {
-            return;
-        }
-        try {
+        Verbosity verbosity = options.getVerbosity();
+        if (verbosity != QUIET) {
             if (message != null) {
                 System.out.print(message);
             }
-
-            if (longMessage != null) {
-                if (options.getVerbosity() == LONG) {
-                    System.out.print(longMessage);
-                }
+            if (longMessage != null && verbosity == LONG) {
+                System.out.print(longMessage);
             }
-        } catch (Throwable e) {
-            System.out.println(e.getMessage());
         }
     }
 

+ 3 - 5
jplag/src/main/java/jplag/Submission.java

@@ -121,11 +121,9 @@ public class Submission implements Comparable<Submission> {
 
     /* parse all the files... */
     public boolean parse() {
-        if (program.getOptions().getVerbosity() != Verbosity.PARSER) {
-            if (files == null || files.size() == 0) {
-                program.print("ERROR: nothing to parse for submission \"" + name + "\"\n", null);
-                return false;
-            }
+        if (files == null || files.size() == 0) {
+            program.print("ERROR: nothing to parse for submission \"" + name + "\"\n", null);
+            return false;
         }
 
         String[] relativeFilePaths = getRelativeFilePaths(submissionFile, files);

+ 1 - 4
jplag/src/main/java/jplag/options/Verbosity.java

@@ -1,14 +1,11 @@
 package jplag.options;
 
-public enum Verbosity { // TODO TS: These levels are not used consistently.
-    PARSER,
+public enum Verbosity {
     QUIET,
     LONG;
 
     public static Verbosity fromOption(String optionName) {
         switch (optionName) {
-        case "parser":
-            return PARSER;
         case "quiet":
             return QUIET;
         case "long":