Skip to content

Commit

Permalink
Remove unused verbosity options.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaglam committed Sep 7, 2021
1 parent 2e593f7 commit 39290c6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 33 deletions.
6 changes: 2 additions & 4 deletions README.md
Expand Up @@ -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
Expand Down
Expand Up @@ -16,7 +16,7 @@ public void print(String normalMsg, String longMsg) {
} 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");
}
}
}
24 changes: 5 additions & 19 deletions 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;
Expand All @@ -19,6 +18,7 @@

import jplag.options.JPlagOptions;
import jplag.options.LanguageOption;
import jplag.options.Verbosity;
import jplag.strategy.ComparisonStrategy;
import jplag.strategy.NormalComparisonStrategy;
import jplag.strategy.ParallelComparisonStrategy;
Expand Down Expand Up @@ -135,28 +135,14 @@ public boolean isFileExcluded(File file) {

@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());
}
}

Expand Down
8 changes: 3 additions & 5 deletions jplag/src/main/java/jplag/Submission.java
Expand Up @@ -121,11 +121,9 @@ private String[] getRelativeFilePaths(File baseFile, List<File> files) {

/* 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);
Expand Down
5 changes: 1 addition & 4 deletions 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":
Expand Down

0 comments on commit 39290c6

Please sign in to comment.