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
@lennoxtr 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.
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)
publicstaticvoidcheckUserInput(Stringinput, intcurrentSize) throwsDukeException {
String[] inputSplitArray = input.split(" ");
List<String> inputSplitList = Arrays.asList(inputSplitArray);
Stringcommand = inputSplitList.get(0);
if (command.equals("TODO")) {
if (inputSplitList.size() <= 1) {
thrownewDukeException("EMPTY TO-DO COMMAND... DOING NOTHING MUCH?");
}
} elseif (command.equals("DEADLINE")) {
if (input.contains(" /BY ")) {
if (inputSplitList.size() <= 3) {
thrownewDukeException("MORE INFO NEEDED FOR DEADLINE");
}
} else {
thrownewDukeException("NO DEADLINE. FREE TIME ISN'T SO EASY TO COME BY.");
}
} elseif (command.equals("EVENT")) {
if (input.contains(" /FROM ") && input.contains(" /TO ")) {
if (inputSplitList.size() <= 5) {
thrownewDukeException("MORE INFO NEEDED FOR EVENT");
}
} else {
thrownewDukeException("MY CREATOR DIDN'T MAKE ME SMART ENOUGH TO INFER INFO FROM THIS...");
}
} elseif (command.equals("MARK")) {
if (inputSplitList.size() == 1) {
thrownewDukeException("MY CREATOR DIDN'T MAKE ME SMART ENOUGH TO INFER INFO FROM THIS...");
}
if (inputSplitList.size() > 2) {
thrownewDukeException("TOO MUCH INFO...");
} else {
if (Integer.valueOf(inputSplitList.get(1)) > currentSize) {
if (currentSize > 1) {
thrownewDukeException("YOU ONLY HAVE " + currentSize + " TASKS");
} else {
thrownewDukeException("YOU ONLY HAVE " + currentSize + " TASK");
}
}
}
} elseif (command.equals("UNMARK")) {
if (inputSplitList.size() == 1) {
thrownewDukeException("MY CREATOR DIDN'T MAKE ME SMART ENOUGH TO INFER INFO FROM THIS...");
}
if (inputSplitList.size() > 2) {
thrownewDukeException("TOO MUCH INFO...");
} else {
if (Integer.valueOf(inputSplitList.get(1)) > currentSize) {
thrownewDukeException("YOU DON'T HAVE THAT MANY TASKS");
}
}
} elseif (command.equals("DELETE")) {
if (inputSplitList.size() > 2) {
thrownewDukeException("TOO MUCH INFO...");
} else {
if (Integer.valueOf(inputSplitList.get(1)) > currentSize) {
thrownewDukeException("YOU DON'T HAVE THAT MANY TASKS");
}
}
} elseif (command.equals("LIST")) {
if (inputSplitList.size() > 1) {
thrownewDukeException("ARE YOU EXPECTING ME TO DO SOMETHING WITH THE EXTRA INFO?");
}
} elseif (command.equals("FIND")) {
} else {
thrownewDukeException("COMMAND NOT FOUND... WHAT ARE YOU UP TO...");
}
}
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.
/** * Construct the {@code Storage} object with * empty database */
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
ℹ️ 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:
@lennoxtr 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/duke/workflow/DoTask.java
lines27-27
: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/duke/io/input/exception/UserInputException.java
lines27-97
:Example from
src/main/java/duke/io/input/ui/UserInteraction.java
lines73-115
:Example from
src/main/java/duke/workflow/DoTask.java
lines53-163
: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/Duke.java
lines6-10
:Example from
src/main/java/duke/io/input/ui/UserInteraction.java
lines26-28
:Example from
src/main/java/duke/util/Storage.java
lines22-25
: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)
possible problems in commit
c8b487f
:Fixed Codestyle
possible problems in commit
714e4cd
:Merge remote-tracking branch 'origin/add-gradle-support' into branch-Level-7
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
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: