You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@kohkaixun 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.
privatestaticvoidcheckEventCommand(Stringstr) {
StringeventSpace = Parser.EVENT + " ";
if (str.equals(Parser.EVENT) || str.equals(eventSpace)) {
thrownewRuntimeException("This command's field can't be left blank!");
}
finalStringtarget1 = " /from ";
finalStringtarget2 = " /to ";
finalvartarget1Length = target1.length();
finalvartarget2Length = target2.length();
if (!(str.contains(target1) && str.contains(target2))) {
thrownewRuntimeException("Unable to create Event! Event commands need a /from and /to field!");
}
intindex1 = str.indexOf(target1);
intindex2 = str.indexOf(target2);
finalvarminCharBetweenTargets = 20;
booleanisTarget1BehindTarget2 = index2 - index1 < 0;
if (isTarget1BehindTarget2) {
thrownewRuntimeException("Unable to create event! "
+ "The /from field has to be before the /to field.");
} elseif (index2 - index1 < minCharBetweenTargets) {
thrownewRuntimeException("Unable to create event! Please enter a valid /from field.");
}
finalinteventDescriptionStartIndex = Parser.EVENT.length() + 1;
if (index1 <= eventDescriptionStartIndex) {
thrownewRuntimeException("Unable to create event! Description for event cannot be left blank");
}
Stringstart = str.substring(index1 + target1Length, index2);
Stringend = str.substring(index2 + target2Length);
intstartFirstSlash = start.indexOf("/");
intstartSecondSlash = start.indexOf("/", startFirstSlash + 1);
intendFirstSlash = end.indexOf("/");
intendSecondSlash = end.indexOf("/", endFirstSlash + 1);
if (startFirstSlash == -1 || startSecondSlash == -1 || endFirstSlash == -1 || endSecondSlash == -1) {
thrownewRuntimeException("Unable to create Deadline! Check your date and time format!");
}
}
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.
/** * Delete task from task list. * @param index Index of task in task list to be deleted. * @return The Duke chatbot's reply after deleting a task. */
/** * Mark a task in task list as done. * @param index Index of task to be marked as done. * @return The Duke chatbot's reply after marking a task as done. */
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 [email protected] if you want to follow up on this post.
The text was updated successfully, but these errors were encountered:
@kohkaixun 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/Duke.java
lines67-132
:Example from
src/main/java/duke/Parser.java
lines34-105
:Example from
src/main/java/duke/Parser.java
lines146-181
: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/duke/TaskList.java
lines37-41
:Example from
src/main/java/duke/TaskList.java
lines52-56
:Example from
src/main/java/duke/TaskList.java
lines73-77
: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
[email protected]
if you want to follow up on this post.The text was updated successfully, but these errors were encountered: