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, 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.
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.
/** * Load past data inputted by user. * @return An array of tasks containing the list of tasks still in the list after user previously exited. * @throws DukeException When filepath of file that is supposed to store past data cannot be created or found. */
/** * Save new data inputted by user. * @param taskList The TaskList object storing the list of Task objects. * @throws DukeException When filepath of file that is supposed to store new data cannot be created or found. */
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 👍
ℹ️ 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, 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/duke/DialogBox.java
lines38-38
://this.displayPicture.setFitWidth(100.0);
Example from
src/main/java/duke/DialogBox.java
lines39-39
://this.displayPicture.setFitHeight(100.0);
Suggestion: Remove dead code from the codebase.
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/DukeException.java
lines18-21
:Example from
src/main/java/duke/Storage.java
lines45-49
:Example from
src/main/java/duke/Storage.java
lines72-76
: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 👍
ℹ️ 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: