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
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 code further.
IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most one example is given i.e., there can be other areas/places to improve.
publicstaticvoidparseCommand(Stringcommand, TaskListtasks) {
/** * This method processes the command by the user and executes them * * @param command The command that the user specified * @param tasks list of tasks that the command will be executed upon */if (command.equals("list")){
listCommand(tasks);
} elseif (command.startsWith("done")){
doneCommand(command,tasks);
} elseif (command.equals("bye")){
try {
Storage.writeToFile("./duke.txt",tasks);
} catch (IOExceptione) {
System.out.println("Error writing to file");
}
System.out.println("Bye. Hope to see you again soon! :)");
System.exit(0);
} else {
String[] splitString = command.split(" ", 2);
if (splitString[0].equals("deadline")){
deadlineCommand(splitString,tasks);
} elseif (splitString[0].equals("todo")){
todoCommand(splitString,tasks);
} elseif (splitString[0].equals("event")) {
eventCommand(splitString,tasks);
} elseif (splitString[0].equals("delete")){
deleteCommand(splitString,tasks);
} elseif (splitString[0].equals("find")) {
findCommand(splitString,tasks);
} else {
errorCommand();
}
}
}
privatestaticvoidlistCommand(TaskListtasks) {
/** * This method prints the list of tasks * * @param tasks list of tasks to be printed */System.out.println("Here are the tasks on your list:");
for (inti = 0; i < tasks.getSize(); i++) {
System.out.printf("%d. %s\n",i +1,tasks.getIndex(i).toString());
}
}
Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods.
The text was updated successfully, but these errors were encountered:
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 code further.
IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most one example is given i.e., there can be other areas/places to improve.
Aspect: Tab Usage
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/duke/Parser.java
line9
:Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods.
The text was updated successfully, but these errors were encountered: