@eunrcn 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/skyler/main/Parser.java
lines 20-66
:
public static String processUserInput(String userInput) throws SkylerException {
String result = "";
if (userInput.equals("list")) {
result = TaskList.listTasks();
} else if (userInput.startsWith("todo")) {
result = TaskList.addTask(new ToDo(getTaskDescription(userInput, 4), false));
} else if (userInput.startsWith("deadline")) {
String[] parts = userInput.split("/by", 2);
if (parts.length != 2 || parts[0].trim().isEmpty() || parts[1].trim().isEmpty()) {
throw new SkylerException(
"Invalid 'deadline' command. Please provide a valid description and deadline.");
}
String description = parts[0].substring(9).trim();
String by = parts[1].trim();
LocalDate byDate = LocalDate.parse(by, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
result = TaskList.addTask(new Deadline(description, byDate, false));
} else if (userInput.startsWith("event")) {
String[] parts = userInput.split("/from", 2);
if (parts.length != 2 || parts[0].trim().isEmpty() || parts[1].trim().isEmpty()) {
throw new SkylerException("Invalid 'event' command. Please provide a valid description and timeframe.");
}
String description = parts[0].substring(6).trim();
String from = parts[1].split("/to")[0].trim();
String to = parts[1].split("/to")[1].trim();
LocalDate fromDate = LocalDate.parse(from, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate toDate = LocalDate.parse(to, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
result = TaskList.addTask(new Event(description, fromDate, toDate, false));
} else if (userInput.startsWith("delete")) {
result = TaskList.deleteTask(userInput);
} else if (userInput.startsWith("undo")) {
result = TaskList.undoTask();
} else if (userInput.startsWith("mark")) {
result = TaskList.markTask(userInput);
} else if (userInput.startsWith("unmark")) {
result = TaskList.unmarkTask(userInput);
} else if (userInput.startsWith("find")) {
result = TaskList.findTasks(userInput.substring(5).trim());
} else if (userInput.startsWith("view")) {
result = TaskList.viewTasksOnDate(userInput);
} else if (userInput.startsWith("help")) {
result = TaskList.help();
}else {
Example from src/main/java/skyler/main/TaskList.java
lines 226-297
:
public static String help() {
StringBuilder guide = new StringBuilder("# Skyler TaskList User Guide\n\n");
guide.append("Welcome to Skyler, your personal task management chatbot!\n\n");
// 1. Adding Tasks
guide.append("## 1. Adding Tasks\n");
guide.append("To add a new task, use one of the following commands:\n\n");
guide.append("```\n");
guide.append("todo Buy groceries\n");
guide.append("deadline Submit report /by 2024-02-29\n");
guide.append("event Team meeting /from 2024-03-01 /to 2024-03-01\n");
guide.append("```\n");
guide.append("Skyler will confirm the addition and update you on the total number of tasks in your list.\n\n");
// 2. Listing Tasks
guide.append("## 2. Listing Tasks\n");
guide.append("To view all tasks in your list, use the following command:\n\n");
guide.append("```\n");
guide.append("list\n");
guide.append("```\n");
guide.append("Skyler will provide a numbered list of all your tasks.\n\n");
// 3. Deleting Tasks
guide.append("## 3. Deleting Tasks\n");
guide.append("You can delete a task by specifying its number in the list. For example:\n\n");
guide.append("```\n");
guide.append("delete 2\n");
guide.append("```\n");
guide.append("This will remove the task at position 2 in your list. Skyler will confirm the deletion and update you on the total number of tasks remaining.\n\n");
// 4. Undoing Tasks
guide.append("## 4. Undoing Tasks\n");
guide.append("Undo the last add operation with the following command:\n\n");
guide.append("```\n");
guide.append("undo\n");
guide.append("```\n");
guide.append("Skyler will confirm the undone operation and update you on the current state of your task list.\n\n");
// 5. Marking Tasks as Done
guide.append("## 5. Marking Tasks as Done\n");
guide.append("To mark a task as done, use the following command:\n\n");
guide.append("```\n");
guide.append("mark 3\n");
guide.append("```\n");
guide.append("This will mark the task at position 3 as done. Skyler will confirm the action.\n\n");
// 6. Marking Tasks as Not Done
guide.append("## 6. Marking Tasks as Not Done\n");
guide.append("To mark a task as not done (undoing a previous mark), use the following command:\n\n");
guide.append("```\n");
guide.append("unmark 3\n");
guide.append("```\n");
guide.append("This will unmark the task at position 3. Skyler will confirm the action.\n\n");
// 7. Finding Tasks
guide.append("## 7. Finding Tasks\n");
guide.append("You can search for tasks containing a specific keyword:\n\n");
guide.append("```\n");
guide.append("find groceries\n");
guide.append("```\n");
guide.append("Skyler will provide a list of tasks that match the keyword.\n\n");
// 8. Viewing Tasks on a Specific Date
guide.append("## 8. Viewing Tasks on a Specific Date\n");
guide.append("To view tasks scheduled for a particular date, use the following command:\n\n");
guide.append("```\n");
guide.append("view 2024-02-29\n");
guide.append("```\n");
guide.append("Skyler will display tasks with deadlines or events on the specified date.\n\n");
return guide.toString();
}
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
No easy-to-detect issues ๐
Aspect: Recent Git Commit Message
possible problems in commit 60a579a
:
possible problems in commit f15a437
:
- Not in imperative mood (?)
- Perhaps too short (?)
possible problems in commit 1e67fae
:
- Not in imperative mood (?)
Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
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 [email protected]
if you want to follow up on this post.