@ovidharshini 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/duke/Parser.java lines 47-129:
public static String parse(String input, TaskList tasklist) throws Exception {
input = input.trim();
String command = input.replaceAll(" .*", "");
input = input.trim();
if (input.equals("bye") || input.equals("list")) {
return command;
}
// Handle do, undo, delete
String firstWord = input.replaceAll(" .*", "");
input = input.substring(firstWord.length()).trim();
switch (firstWord) {
case "do":
// Fallthrough
case "undo":
// Fallthrough
case "delete":
int index = Integer.parseInt(input);
input = input.replaceAll(".* ", "");
if (input.matches("[0-9]+") && index <= tasklist.size()
&& index >= 1) {
assert index <= tasklist.size() : "index not within range";
return command;
}
throw new Exception("You need to specify the task you want to "
+ firstWord + " by its index :c");
case "todo":
if (input.equals("")) {
throw new Exception("Oops, you need to mention what the "
+ "task is :c");
}
return command;
case "deadline":
if (!input.contains(" by ")) {
throw new Exception("Oops, you need to format deadline tasks "
+ "as \"deadline X by Y\" :c");
}
String lastWord = input.substring(input.lastIndexOf(" ") + 1);
if (lastWord.equals("by")) {
return "";
}
return command;
case "event":
if (!input.contains(" at ")) {
throw new Exception("Oops, you need to format event tasks "
+ "as \"event X at Y\" :c");
}
String finalWord = input.substring(input.lastIndexOf(" ") + 1);
if (finalWord.equals("at")) {
return "";
}
return command;
case "doafter":
if (!input.contains(" after ")) {
throw new Exception("Oops, you need to format doafter tasks "
+ "as \"doafter X after Y\" :c");
}
String endWord = input.substring(input.lastIndexOf(" ") + 1);
if (endWord.equals("after")) {
return "";
}
return command;
case "find":
if (input.equals("")) {
throw new Exception("Oops, you need to mention what "
+ "the keyword is :c");
}
if (input.contains(" ")) {
throw new Exception("Oops, you can only search for "
+ "one keyword at a time :c");
}
return command;
default:
return "";
}
}
Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten 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/duke/gui/MainWindow.java lines 82-84:
Example from src/main/java/duke/task/Task.java lines 47-53:
/**
* Default toString method that returns the description of Task.
* Includes completion status.
*
* @return formatted string of the description and completeness status
* of Task.
*/
Example from src/main/java/duke/task/TaskList.java lines 92-96:
/**
* Default toString method that returns list of all tasks.
*
* @return formatted string of all Tasks in TaskList delimited by newlines.
*/
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 (Subject Only)
No easy-to-detect issues 👍
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 cs2103@comp.nus.edu.sg if you want to follow up on this post.
@ovidharshini 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/duke/Parser.javalines47-129:Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten 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/duke/gui/MainWindow.javalines82-84:Example from
src/main/java/duke/task/Task.javalines47-53:Example from
src/main/java/duke/task/TaskList.javalines92-96: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 (Subject Only)
No easy-to-detect issues 👍
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
cs2103@comp.nus.edu.sgif you want to follow up on this post.