@Taoseeker 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
Example from src/main/java/gui/DialogBox.java lines 25-25:
Example from src/main/java/gui/DialogBox.java lines 26-26:
// displayPicture = new ImageView(i);
Example from src/main/java/gui/DialogBox.java lines 27-27:
// this.getChildren().addAll(text, displayPicture);
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from src/main/java/neochat/task/Parser.java lines 24-85:
public String parseCommand(String input) {
if (input == null || input.trim().isEmpty()) {
throw new IllegalArgumentException("The input is empty");
}
String s = ""; // a dummy variable to hold returned string
String[] tokens = input.split("\\s+", 2);
String commandType = tokens[0].toLowerCase();
String remainingInput = (tokens.length > 1) ? tokens[1] : "";
try {
switch (commandType) {
case "todo":
s = parseTodo(remainingInput);
break;
case "deadline":
s = parseDeadline(remainingInput);
break;
case "event":
s = parseEvent(remainingInput);
break;
case "edit":
s = editTask(remainingInput);
case "bye" :
taskList.saveTasks();
s = "bye";
break;
case "list":
s = taskList.printList();
break;
case "mark":
s = taskList.markAsDone(remainingInput);
break;
case "unmark":
s = taskList.markAsNotDone(remainingInput);
break;
case "delete":
s = taskList.delete(remainingInput);
break;
case "archive":
s = taskList.archive(remainingInput);
break;
case "loadarchive":
taskList.loadArchivedTasks();
s = "successfully loaded archived tasks!";
break;
case "help":
s = printCommandList();
break;
case "find":
s = taskList.findTasks(remainingInput);
break;
default:
s = "Unknown command type" + commandType + "\n"
+ "key in 'help' for more information.'";
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
assert s != null : "parseCommand() should not return null";
assert !s.isEmpty() : "parseCommand() should not return empty string";
return s;
}
Example from src/main/java/neochat/task/tasklist/TaskList.java lines 126-176:
private Task parseTask(String line) {
String[] parts = line.split(" \\| ");
if (parts.length < 3) {
return null;
}
String type = parts[0];
boolean isDone = parts[1].equals("1");
String description = parts[2];
try {
switch (type) {
case "T":
Todo todo = new Todo(description);
if (isDone) {
todo.markAsDone();
}
return todo;
case "D":
if (parts.length < 4) {
return null;
}
LocalDateTime by = parseDateTime(parts[3].trim());
Deadline deadline = new Deadline(description, by);
if (isDone) {
deadline.markAsDone();
}
return deadline;
case "E":
if (parts.length < 5) {
return null;
}
LocalDateTime from = parseDateTime(parts[3].trim());
LocalDateTime to = parseDateTime(parts[4].trim());
Event event = new Event(description, from, to);
if (isDone) {
event.markAsDone();
}
return event;
default:
return null;
}
} catch (EmptyTaskDescriptionException e) {
// Should not reach this line: anything in the saved file should have a description as this exception is
// already handled when the user set the task
System.out.println("Wrong format of task description in the saved list, please check if the saved list is "
+ "edited accidentally");
return null;
}
}
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 Messages
possible problems in commit e412123:
Improve code quality
There are several methods names that are unintuitve. Change the names into more intuitive ones.
Some methods are not self-explanatory. Add comment to these methods to improve readability.
Delete some redundant comments.
- body not wrapped at 72 characters: e.g.,
There are several methods names that are unintuitve. Change the names into more intuitive ones.
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 👍
ℹ️ 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.
@Taoseeker 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
Example from
src/main/java/gui/DialogBox.javalines25-25:// text = new Label(s);Example from
src/main/java/gui/DialogBox.javalines26-26:// displayPicture = new ImageView(i);Example from
src/main/java/gui/DialogBox.javalines27-27:// this.getChildren().addAll(text, displayPicture);Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/neochat/task/Parser.javalines24-85:Example from
src/main/java/neochat/task/tasklist/TaskList.javalines126-176: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 Messages
possible problems in commit
e412123:There are several methods names that are unintuitve. Change the names into more intuitive ones.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 👍
ℹ️ 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.sgif you want to follow up on this post.