You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@reneeyeow02 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.
publicstaticCommandparse(StringuserInput) {
userInput = userInput.trim();
String[] splitUI = userInput.split(" ");
assertsplitUI.length > 0 : "splitUI should not be empty";
switch (splitUI[0]) {
case"hi":
returnnewHiCommand();
case"list":
returnnewListCommand();
case"bye":
returnnewExitCommand();
case"undo":
returnnewUndoCommand();
default:
break;
}
String[] splitUserInput = userInput.split(" ", 2);
StringcmdWord = splitUserInput[0];
switch (cmdWord) {
case"mark":
try {
inttaskNum = Integer.parseInt(splitUserInput[1]);
returnnewMarkCommand(true, taskNum);
} catch (NumberFormatException | ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= Meowmeow needs a number for the task you want to mark!");
}
case"unmark":
try {
inttaskNum = Integer.parseInt(splitUserInput[1]);
returnnewMarkCommand(false, taskNum);
} catch (NumberFormatException | ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= Meowmeow needs a number for the task you want to unmark!");
}
case"todo":
try {
StringtaskName = splitUserInput[1];
returnnewAddCommand('T', taskName);
} catch (ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= Meowmeow needs a name for the todo you want to add!");
}
case"deadline":
try {
StringnameAndLocalDateTime = splitUserInput[1];
returnnewAddCommand('D', nameAndLocalDateTime);
} catch (ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= To add a deadline type it in in this format: "
+ "deadline (name) /by (YYYY-MM-DDTHH:MM:SS)");
}
case"event":
try {
StringnameAndTime = splitUserInput[1];
returnnewAddCommand('E', nameAndTime);
} catch (ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= To add an event type it in in this format: event (name) /at (time)");
}
case"delete":
try {
inttaskToDelete = Integer.parseInt(splitUserInput[1]);
returnnewDeleteCommand(taskToDelete);
} catch (NumberFormatException | ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= Meowmeow needs a number for the task you want to delete!");
}
case"find":
try {
StringtaskToFind = splitUserInput[1];
returnnewFindCommand(taskToFind);
} catch (ArrayIndexOutOfBoundsExceptione) {
returnnewDefaultCommand("=0w0= Meowmeow needs a name for the task you want to find!");
}
default:
returnnewDefaultCommand("Sowwie meowmeow doesn't understand what you said uwu ♥ \n"
+ "Try typing something else! owo");
}
}
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.
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 Message (Subject Only)
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.
The text was updated successfully, but these errors were encountered:
@reneeyeow02 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/meowmeow/Parser.java
lines19-108
:Example from
src/main/java/meowmeow/Storage.java
lines60-127
: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
No easy-to-detect issues 👍
Aspect: Header Comments
Example from
src/main/java/meowmeow/Meowmeow.java
lines24-28
:Example from
src/main/java/meowmeow/events/Task.java
lines22-24
:Example from
src/main/java/meowmeow/events/Task.java
lines29-31
: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 Message (Subject Only)
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.The text was updated successfully, but these errors were encountered: