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
@DesSnowy We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, to help you improve the iP code further.
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.
publicStringgetResponse(Stringinput) {
Stringresult;
Tasktask;
String[] parsedInput = Parser.parse(input);
assertparsedInput.length == 2: "Parsed length should be 2";
Stringcommand = parsedInput[0];
Stringdescription = parsedInput[1];
assertcommand != null : "Command should not be null";
switch (command) {
case"bye":
result = ui.printEnding();
break;
case"list":
result = ui.printList(this.tasks);
break;
case"mark":
try {
intindex = Integer.parseInt(description);
task = tasks.markTask(index);
asserttask != null : "task should not be null";
result = ui.printMarkDone(task);
} catch (NumberFormatException | SnowyExceptione) {
result = ui.printIndexError();
}
break;
case"unmark":
try {
intindex = Integer.parseInt(description);
task = tasks.unmarkTask(index);
asserttask != null : "task should not be null";
result = ui.printMarkIncomplete(task);
} catch (NumberFormatException | SnowyExceptione) {
result = ui.printIndexError();
}
break;
case"todo":
try {
task = tasks.addToDo(description);
asserttask != null : "task should not be null";
result = "New todo task added:\n" + task;
} catch (SnowyExceptione) {
result = ui.printTodoFormatError();
}
break;
case"deadline":
try {
task = tasks.addDeadline(description);
asserttask != null : "task should not be null";
result = ("New Deadline task added:\n" + task);
} catch (SnowyExceptione) {
result = ui.printDeadlineFormatError();
}
break;
case"event":
try {
task = tasks.addEvent(description);
asserttask != null : "task should not be null";
result = ("New Event task added:\n " + task);
} catch (SnowyExceptione) {
result = ui.printEventFormatError();
}
break;
case"delete":
try {
intindex = Integer.parseInt(description);
task = tasks.deleteTask(index);
asserttask != null : "task should not be null";
result = ui.printDeleteTask(task);
} catch (NumberFormatException | SnowyExceptione) {
result = "Invalid index format. Please try again";
}
break;
case"find":
ArrayList<Task> foundTasks = tasks.findTask(description);
result = ui.printFoundTask(foundTasks);
break;
case"hello":
result = ui.printGreeting();
break;
case"snooze":
try {
task = tasks.changeDate(description);
result = ui.printDateChange(task);
} catch (NumberFormatException |SnowyExceptione) {
result = ui.printChangeDateError(e.getMessage());
}
break;
default:
result = ui.printUnknownCommand();
break;
}
try {
storage.save(tasks.toSaveString());
} catch (SnowyExceptione) {
result = ui.printUpdateError();
}
returnresult;
}
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.
/** * Write into the file with the specified String. * @param saveLines the lines to be saved into the file. * @throws SnowyException if the file is unable to be updated. */
/** * Find all task which description matches the specifed string before returning them in an arrayList. * @param description The String to be matched. * @return An ArrayList of tasks which matches the string */
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 👍
ℹ️ 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 [email protected] if you want to follow up on this post.
The text was updated successfully, but these errors were encountered:
@DesSnowy We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, to help you improve the iP code further.
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/snowy/Snowy.java
lines27-138
: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/snowy/Storage.java
lines50-54
:Example from
src/main/java/snowy/Task.java
lines35-38
:Example from
src/main/java/snowy/TaskList.java
lines213-217
: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 👍
ℹ️ 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
[email protected]
if you want to follow up on this post.The text was updated successfully, but these errors were encountered: