@jeronkk 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/lechatbot/Parser.java lines 39-99:
public static Command parse(String userInput) throws LeChatBotException {
String[] parts = userInput.split(" ", 2);
String commandWord = parts[0].trim();
String taskDetails = (parts.length > 1) ? parts[1].trim() : "";
switch (commandWord) {
case "todo":
assert taskDetails != null : ERROR_EMPTY_TODO;
if (taskDetails.isEmpty()) {
throw new LeChatBotException(ERROR_EMPTY_TODO);
}
return new AddCommand(new Todo(taskDetails));
case "deadline":
assert taskDetails != null : ERROR_EMPTY_DEADLINE;
if (taskDetails.isEmpty()) {
throw new LeChatBotException(ERROR_EMPTY_DEADLINE);
}
if (!taskDetails.contains("/by")) {
throw new LeChatBotException(ERROR_INVALID_DEADLINE);
}
return DeadlineCommand.createFromUserInput(taskDetails);
case "event":
assert taskDetails != null : ERROR_EMPTY_EVENT;
if (taskDetails.isEmpty()) {
throw new LeChatBotException(ERROR_EMPTY_EVENT);
}
if (!taskDetails.contains("/from") || !taskDetails.contains("/to")) {
throw new LeChatBotException(ERROR_INVALID_EVENT);
}
return EventCommand.createFromUserInput(taskDetails);
case "list":
return new ListCommand();
case "mark":
case "unmark":
case "delete":
assert taskDetails != null : ERROR_MISSING_TASK_NUMBER;
if (taskDetails.isEmpty()) {
throw new LeChatBotException(ERROR_MISSING_TASK_NUMBER);
}
return processTaskCommand(commandWord, taskDetails);
case "find":
if (taskDetails.isEmpty()) {
throw new LeChatBotException("OOPS!!! You must specify a keyword to search.");
}
return new FindCommand(taskDetails);
case "bye":
return new ExitCommand();
case "help":
return new HelpCommand();
default:
throw new LeChatBotException(ERROR_INVALID_COMMAND);
}
}
Example from src/main/java/lechatbot/ui/Ui.java lines 33-84:
public void showWelcome() {
String asciiArt = """
@@@@@@@@@@@@ \s
@@@@%#*#*##%@@@@@ \s
@@#**++++++****####@@ \s
@%#*+=-=======+++*###@@ \s
@@**---:-======+==-=###@@ \s
@%++*+=+**++==+*##*****%@ \s
%#+##+=--::-::::---+#%**%@ \s
#*##*+#%@+=....=#@@%+*%*#@ \s
%####=*##%==----==**%****##@%% \s
-#=#@+=*==+###+=++%%%*=*#+%#=*# \s
*.-%*-:::---=+==-=++=-:::=*%+:- \s
*%+%+=..:-*=-. ..-++-..=*#+%# \s
+#@*+..::.:-=*##+=-:.::.:+#%+* \s
*@@**--=*#%@%%##%*@@%*=-=#%%* \s
@@%+-.-*@+- -#@*-:=%@@ \s
@@@@@@=-==: . =**-*@@@@@ \s
#@@@@@@@#::*%%#**--@@@@@@@@ \s
@@@@@@@@@-.-=+:.=@@@@@@@@ \s
@@@@@@@@@@@#%%*#@@@@@@@@@ \s
@@@@@@@@@@@@@@@@@@@@@@@ \s
*#@@@@@@@@@@@@@@@@@%* \s
@#=--+%@@@@@@@@@@%+==*%%@*: \s
+.#@####*=-::-==+-:-+==+---=+#**:==... \s
.. .:.+#==++--...:--=+*=---:--==++@@@...... # \s
..... =:.=:-==--:.....:---::.::::==+..%@@=:.. @.-% \s
%# ....... -.+-:--:::::::......::::::+:.% ....-@@@=+@### \s
##..# ........ +..+:::.........:......:=..* ....... %:=+*#*#*%% \s
@%%%+%*.*: ........ =..===---........---=..+ ........ *..==+++*#*#@% \s
@@%*#=++=--..% ........... ::...::::-:::..:...+ .......... =..--==+++++*%%@ \s
@@%*+*=====--..+ ............. *.....::....* ..........:.. -.-:-=====+**++% \s
%%*===*==-=--::.. ................. .. ......::=::...... +...:::---=#+=*%% \s
%#==--=-:---::.... .......................................-.... ...:.:::::==-=**#@ \s
%#+---:::::....::.. ......-.............................:........ -.....::.-==++**%@ \s
%#*==---:.:.:..:::.: ...:*:........................................ :..:.....:--+=+*%% \s
%*+-=::....:-::-...+ ............................................... =..:....:..---+#%% \s
""";
String asciiText = """
██╗ ███████╗██████╗ ██████╗ ██████╗ ███╗ ██╗ ██╗ █████╗ ███╗ ███╗███████╗███████╗
██║ ██╔════╝██╔══██╗██╔══██╗██╔═══██╗████╗ ██║ ██║██╔══██╗████╗ ████║██╔════╝██╔════╝
██║ █████╗ ██████╔╝██████╔╝██║ ██║██╔██╗ ██║ ██║███████║██╔████╔██║█████╗ ███████╗
██║ ██╔══╝ ██╔══██╗██╔══██╗██║ ██║██║╚██╗██║ ██ ██║██╔══██║██║╚██╔╝██║██╔══╝ ╚════██║
███████╗███████╗██████╔╝██║ ██║╚██████╔╝██║ ╚████║ ╚█████╔╝██║ ██║██║ ╚═╝ ██║███████╗███████║
╚══════╝╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝
""";
System.out.println(asciiArt + asciiText);
showLine();
System.out.println("Hello! I'm LeChatBot.");
System.out.println("What can I do for you?");
showLine();
}
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
Example from src/main/java/lechatbot/LeChatBot.java lines 119-123:
/**
* The main method that starts the LeChatBot application.
*
* @param args Command line arguments (not used).
*/
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 Messages
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.
@jeronkk 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/lechatbot/Parser.javalines39-99:Example from
src/main/java/lechatbot/ui/Ui.javalines33-84: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
Example from
src/main/java/lechatbot/LeChatBot.javalines119-123: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 Messages
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.