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
@yadobler 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.
Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)
privatevoidmainLoop() {
while (ui.hasInputLines()) {
StringuserInput = ui.getNextInputLine().trim();
String[] userInputSlices = userInput.split(" ");
try {
switch (parser.parseCommand(userInputSlices[0])) {
caseEXIT:
// exits the function, ending the main loopreturn;
caseALIAS:
// creates new alias// TODO: abstract this out to a Command objectparser.addAlias(userInputSlices[1], userInputSlices[2]);
ui.printf(ReplyTextMessages.ALIAS_ADDED_TEXT_2s,
userInputSlices[1],
userInputSlices[2]);
break;
caseRESET_LIST:
// resets any filter on the listuserList = newResetViewCommand()
.setEnvironment(ui, userList, false)
.runCommand()
.getNewUserList();
break;
caseLIST:
// lists out all tasks that fits current filter (if any)newPrintUserTaskListCommand()
.setEnvironment(ui, userList).runCommand();
break;
caseMARK:
// marks a task as Done, given the indexuserList = newChangeTaskListStatusCommand(userInputSlices)
.setEnvironment(ui, userList, true)
.runCommand()
.getNewUserList();
break;
caseUNMARK:
// unmarks a task as Done, given the indexuserList = newChangeTaskListStatusCommand(userInputSlices)
.setEnvironment(ui, userList, false)
.runCommand()
.getNewUserList();
break;
caseDELETE:
// deletes a task from list, given the indexuserList = newDeleteTaskCommand(userInputSlices)
.setEnvironment(ui, userList)
.runCommand()
.getNewUserList();
break;
caseTODO:
// creates a new to-do taskuserList = newCreateTodoCommand(userInputSlices)
.setEnvironment(ui, userList)
.runCommand()
.getNewUserList();
break;
caseEVENT:
// creates a new event taskuserList = newCreateEventCommand(userInputSlices)
.setEnvironment(ui, userList)
.runCommand()
.getNewUserList();
break;
caseDEADLINE:
// creates a new deadline taskuserList = newCreateDeadlineCommand(userInputSlices)
.setEnvironment(ui, userList)
.runCommand()
.getNewUserList();
break;
caseFIND:
// creates a filtered list view with tasks matching the given criteriauserList = newFindStringInTasksCommand(userInputSlices)
.setEnvironmen(ui, userList)
.runCommand()
.getNewUserList();
break;
caseUNKNOWN:
default:
// catch-all for malformed commands marked UNKNOWN, or any uncaught and// unimplemented comanndthrownewYappingBotUnknownCommandException();
}
} catch (YappingBotExceptione) {
ui.printError(e);
}
}
}
voiddeserializeTest() {
Eventt = newEvent();
Stringinput1 = "EVENT:a:false:2023-12-11:2024-12-23";
t.deserialize(input1.split(":"));
assertEquals("a", t.getTaskName());
assertFalse(t.isTaskDone());
assertEquals("2023-12-11", t.getStartTime());
assertEquals("2024-12-23", t.getEndTime());
Stringinput2 = "EVENT:b:true:2003-12-11:2014-12-23";
t.deserialize(input2.split(":"));
assertEquals("b", t.getTaskName());
assertTrue(t.isTaskDone());
assertEquals("2003-12-11", t.getStartTime());
assertEquals("2014-12-23", t.getEndTime());
Stringinput3 = "EVENT:c:true:2011-12-23:2023-12-22:extra:data";
t.deserialize(input3.split(":"));
assertEquals("c", t.getTaskName());
assertTrue(t.isTaskDone());
Stringinput4 = "asdlkjdlkdja:c:true:extra:data:12323123";
YappingBotExceptione1 = assertThrowsExactly(YappingBotInvalidSaveFileException.class,
() -> t.deserialize(input4.split(":")));
StringexpectedErrorMessage1 = "Error Reading save file! The following error was "
+ "encountered: No enum constant yappingbot.tasks."
+ "tasklist.TaskTypes." + input4.split(":")[0];
assertEquals(expectedErrorMessage1, e1.getErrorMessage());
Stringinput5 = "EVENT:";
YappingBotExceptione2 = assertThrowsExactly(YappingBotInvalidSaveFileException.class,
() -> t.deserialize(input5.split(":")));
StringexpectedErrorMessage2 = "Error Reading save file! The following error was "
+ "encountered: Missing Data Values";
assertEquals(expectedErrorMessage2, e2.getErrorMessage());
Stringinput6 = "EVENT:f:true:INVALID-date:INVALID-date";
YappingBotExceptione3 = assertThrowsExactly(YappingBotInvalidSaveFileException.class,
() -> t.deserialize(input6.split(":")));
StringexpectedErrorMessage3 = "Error Reading save file! The following error was "
+ "encountered: I'm sorry, I do not understand what "
+ "'INVALID-date' is!\nTime value must be given in any "
+ "valid date-time format!";
assertEquals(expectedErrorMessage3, e3.getErrorMessage());
Stringinput7 = "EVENT:f:true:2023-12-12:INVALID-date";
YappingBotExceptione4 = assertThrowsExactly(YappingBotInvalidSaveFileException.class,
() -> t.deserialize(input7.split(":")));
StringexpectedErrorMessage4 = "Error Reading save file! The following error was "
+ "encountered: I'm sorry, I do not understand what "
+ "'INVALID-date' is!\nTime value must be given in any "
+ "valid date-time format!";
assertEquals(expectedErrorMessage4, e4.getErrorMessage());
}
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.
/** * Set the necessary values needed to execute this command. * * @param currentUserList TaskList that needs to be resetted * @return this object, useful for chainning */
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
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:
@yadobler 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
Example from
src/main/java/yappingbot/commands/CommandBase.java
lines24-24
:Example from
src/main/java/yappingbot/commands/commands/ResetViewCommand.java
lines15-15
:Example from
src/main/java/yappingbot/ui/gui/MainWindow.java
lines37-37
:Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)
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/yappingbot/YappingBot.java
lines84-174
:Example from
src/test/java/yappingbot/tasks/DeadlineTest.java
lines103-145
:Example from
src/test/java/yappingbot/tasks/EventTest.java
lines105-159
: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/yappingbot/Launcher.java
lines13-20
:Example from
src/main/java/yappingbot/YappingBot.java
lines81-83
:Example from
src/main/java/yappingbot/commands/CreateTaskCommandBase.java
lines61-66
: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
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: