@mistyk786 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
Example from src/main/java/carol/Carol.java lines 39-39:
Example from src/main/java/commands/FindCommand.java lines 15-15:
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/io/EventParser.java lines 36-95:
public static Task parseTaskFromFile(String line) throws CarolException {
String[] parts = line.split(" \\| ");
if (parts.length < 3) {
throw new CarolException("Invalid task format: Missing essential fields. \n");
}
String taskType = parts[0];
String isDoneStr = parts[1];
String description = parts[2];
if (!isDoneStr.equals(" ") && !isDoneStr.equals("X")) {
throw new CarolException("Invalid task format: Unrecognized essential field: " + isDoneStr + "\n");
}
boolean isDone = isDoneStr.equals(" ");
try {
switch (taskType) {
case "T":
ToDo todo = new ToDo(description);
if (isDone) {
todo.markAsDone();
}
return todo;
case "D":
if (parts.length < 4) {
throw new CarolException("Invalid Deadline format: Missing date/time.");
}
String deadlineString = parts[3];
LocalDate date = LocalDate.parse(deadlineString, DATE_FORMATS[0]);
LocalTime time = LocalTime.parse(deadlineString, TIME_FORMATS[0]);
Deadline deadline = new Deadline(description, date, time);
if (isDone) {
deadline.markAsDone();
}
return deadline;
case "E":
if (parts.length < 5) {
throw new CarolException("Invalid Event format: Missing start or end date/time.");
}
String[] eventStartParts = parts[3].split(" ");
String[] eventEndParts = parts[4].split(" ");
LocalDate eventDateStart = LocalDate.parse(eventStartParts[0]);
LocalTime eventTimeStart = LocalTime.parse(eventStartParts[1]);
LocalDate eventDateEnd = LocalDate.parse(eventEndParts[0]);
LocalTime eventTimeEnd = LocalTime.parse(eventEndParts[1]);
Event event = new Event(description, eventDateStart, eventDateEnd, eventTimeStart, eventTimeEnd);
if (isDone) {
event.markAsDone();
}
return event;
default:
throw new CarolException("Unknown task type: " + taskType);
}
} catch (DateTimeParseException e) {
throw new CarolException(e.getMessage());
}
}
Example from src/main/java/io/EventParser.java lines 105-156:
public static void parseTask(String line, String taskType, Tasklist tasks) throws CarolException {
try {
switch (taskType) {
case "todo":
ToDo t = new ToDo(line.toLowerCase());
tasks.addTask(t);
break;
case "deadline":
String[] parts = line.split(" /by ", 2);
if (parts.length != 2) {
throw new CarolException("""
Invalid task format: Missing date/time
Use following format for deadlines: deadline [message] /by [date][time]
""");
}
String deadlineDescription = parts[0].trim().toLowerCase();
String deadlineString = parts[1].trim();
LocalDate date = parseDate(deadlineString.split(" ")[0]);
LocalTime time = parseTime(deadlineString.split(" ")[1]);
Deadline deadline = new Deadline(deadlineDescription, date, time);
tasks.addTask(deadline);
break;
case "event":
String[] parts2 = line.split(" /from | /to ");
if (parts2.length != 3) {
throw new CarolException("""
Invalid task format: Missing date/time
Use following format for events: event [message] /from [date][time] /to [date][time]
""");
}
String eventDescription = parts2[0].trim().toLowerCase();
String eventStartString = parts2[1].trim();
String eventEndString = parts2[2].trim();
LocalDate startDate = parseDate(eventStartString.split(" ")[0]);
LocalTime startTime = parseTime(eventStartString.split(" ")[1]);
LocalDate endDate = parseDate(eventEndString.split(" ")[0]);
LocalTime endTime = parseTime(eventEndString.split(" ")[1]);
Event event = new Event(eventDescription, startDate, endDate, startTime, endTime);
tasks.addTask(event);
break;
default:
throw new CarolException("Unknown task type: " + taskType);
}
} catch (DateTimeParseException e) {
Ui.showError(e.getMessage());
}
}
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 a683988:
- Not in imperative mood (?)
possible problems in commit 2eb3123:
- Not in imperative mood (?)
possible problems in commit d11b3cc:
Changed class names to match coding standard
- 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 👍
ℹ️ 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.
@mistyk786 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
Example from
src/main/java/carol/Carol.javalines39-39:Example from
src/main/java/commands/FindCommand.javalines15-15: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/io/EventParser.javalines36-95:Example from
src/main/java/io/EventParser.javalines105-156: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
a683988:possible problems in commit
2eb3123:possible problems in commit
d11b3cc: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.