@CXl0l0 We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, so that you can avoid similar problems in your tP code (which will be graded more strictly for code quality).
IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most three example are given i.e., there can be other areas/places to improve.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
No easy-to-detect issues 👍
Aspect: Brace Style
No easy-to-detect issues 👍
Aspect: Package Name Style
No easy-to-detect issues 👍
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
No easy-to-detect issues 👍
Aspect: Method Length
Example from src/main/java/sigma/command/Parser.java lines 224-274:
private static String[] parseEditEvent(String[] tokens) throws NoNewEventInfoException {
String[] newInfos = new String[3];
String newTaskName = "";
String newStartDate = "";
String newEndDate = "";
if (tokens.length < 3 || !tokens[2].equals("/name")
&& !tokens[2].equals("/from")
&& !tokens[2].equals("/to")) {
throw new NoNewEventInfoException();
}
boolean isReadingNewTaskName = false;
boolean isReadingFrom = false;
boolean isReadingTo = false;
for (int i = 2; i < tokens.length; i++) {
String str = tokens[i];
if (str.equals("/name")) {
isReadingNewTaskName = true;
isReadingFrom = false;
isReadingTo = false;
continue;
} else if (str.equals("/from")) {
isReadingNewTaskName = false;
isReadingFrom = true;
isReadingTo = false;
continue;
} else if (str.equals("/to")) {
isReadingNewTaskName = false;
isReadingFrom = false;
isReadingTo = true;
continue;
} else if (isReadingNewTaskName) {
newTaskName += " " + str;
} else if (isReadingFrom) {
newStartDate += " " + str;
} else if (isReadingTo) {
newEndDate += " " + str;
}
}
if (newTaskName == "" && newStartDate == "" && newEndDate == "") {
throw new NoNewEventInfoException();
}
newInfos[0] = newTaskName;
newInfos[1] = newStartDate;
newInfos[2] = newEndDate;
return newInfos;
}
Example from src/main/java/sigma/command/Ui.java lines 100-145:
private String handleMark(String[] tokens) {
String response = "";
if (tokens.length > 2) { //unknown elements after command
response = "I don't know what you're talking about.";
line();
System.out.println(replyPrefix + "I don't know what you're talking about.");
line();
} else {
try {
int index = Parser.parseIndex(tokens);
taskList.markDone(index);
response += "Good job bro, keep the grind going!\n";
response += taskList.getTask(index - 1).toString();
line();
System.out.println("Good job bro, keep the grind going!");
System.out.println(taskList.getTask(index - 1));
line();
} catch (ArrayIndexOutOfBoundsException e) {
response = "Which one do you want to mark exactly?";
line();
System.out.println(replyPrefix + "Which one do you want to mark exactly?");
line();
} catch (IndexOutOfBoundsException e) {
response = "Enter a valid task number. "
+ "There probably ain't even any tasks to mark you bum.";
line();
System.out.println(replyPrefix + "Enter a valid task number. "
+ "There probably ain't even any tasks to mark you bum.");
line();
} catch (NumberFormatException e) {
response = "Huh?";
line();
System.out.println("Huh?");
line();
}
}
return response;
}
Example from src/main/java/sigma/command/Ui.java lines 153-197:
private String handleUnmark(String[] tokens) {
if (tokens.length > 2) { //unknown elements after command
line();
System.out.println(replyPrefix + "I don't know what you're talking about.");
line();
return "I don't know what you're talking about.";
}
String response = "";
try {
int index = Parser.parseIndex(tokens);
taskList.markUndone(index);
response += "Come on bruh, focus!\n";
response += taskList.getTask(index - 1).toString();
line();
System.out.println("Come on bruh, focus!");
System.out.println(taskList.getTask(index - 1));
line();
} catch (ArrayIndexOutOfBoundsException e) {
response = "Which one do you want to unmark exactly?";
line();
System.out.println(replyPrefix + "Which one do you want to unmark exactly?");
line();
} catch (IndexOutOfBoundsException e) {
response = "Enter a valid task number. "
+ "There probably ain't even any tasks to unmark you bum.";
line();
System.out.println(replyPrefix + "Enter a valid task number. "
+ "There probably ain't even any tasks to unmark you bum.");
line();
} catch (NumberFormatException e) {
response = "Huh?";
line();
System.out.println("Huh?");
line();
}
return response;
}
Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods e.g., extract some code blocks into separate methods. You may ignore this suggestion if you think a longer method is justified in a particular case.
Aspect: Class size
Suggestion: Consider breaking large classes into smaller ones, if appropriate. A long class is a sign that perhaps it is dong 'too much'.
Aspect: Header Comments
Example from src/main/java/sigma/command/Ui.java lines 57-59:
/**
* Close up the dialogue and exits the system.
*/
Example from src/main/java/sigma/command/Ui.java lines 593-595:
/**
* UI tool to print a line for graphic purpose.
*/
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
Aspect: Recent Git Commit Messages
No easy-to-detect issues 👍
Aspect: Binary files in repo
No easy-to-detect issues 👍
❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality issues.
ℹ️ The bot account used to post this issue is un-manned. Do not reply to this post (as those replies will not be read). Instead, contact cs2103@comp.nus.edu.sg if you want to follow up on this post.
@CXl0l0 We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, so that you can avoid similar problems in your tP code (which will be graded more strictly for code quality).
IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most three example are given i.e., there can be other areas/places to improve.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
No easy-to-detect issues 👍
Aspect: Brace Style
No easy-to-detect issues 👍
Aspect: Package Name Style
No easy-to-detect issues 👍
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
No easy-to-detect issues 👍
Aspect: Method Length
Example from
src/main/java/sigma/command/Parser.javalines224-274:Example from
src/main/java/sigma/command/Ui.javalines100-145:Example from
src/main/java/sigma/command/Ui.javalines153-197:Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods e.g., extract some code blocks into separate methods. You may ignore this suggestion if you think a longer method is justified in a particular case.
Aspect: Class size
/Users/damithch/Repos/folder_for_temp_data/AY2425S2/cs2103/./ip/ip/CXl0l0/src/main/java/sigma/command/Ui.java(600 lines)Suggestion: Consider breaking large classes into smaller ones, if appropriate. A long class is a sign that perhaps it is dong 'too much'.
Aspect: Header Comments
Example from
src/main/java/sigma/command/Ui.javalines57-59:Example from
src/main/java/sigma/command/Ui.javalines593-595:Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
Aspect: Recent Git Commit Messages
No easy-to-detect issues 👍
Aspect: Binary files in repo
No easy-to-detect issues 👍
❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality issues.
ℹ️ The bot account used to post this issue is un-manned. Do not reply to this post (as those replies will not be read). Instead, contact
cs2103@comp.nus.edu.sgif you want to follow up on this post.