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
@Nigeltzy 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.
intidx, Stringinput, String[] commandParts, boolean ... b) {
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)
publicstaticCommandparse(Stringinput) throwsShnoopException {
StringimproperInput =
"You could travel the world, but nothing comes close to choosing a task type.\n\n"
+ "I have a few California Gorls for you to try out. \n\n "
+ "Try typing 'todo', 'event' or 'deadline' followed by stating the task description. \n"
+ "Other commands you could try out too are list, mark, unmark, find, delete \n"
+ "And don't tell anyone else I told you this but you can also type 'list 1' to sort tasks!\n"
+ "But perhaps the most imporant of all, you MUST say 'bye' to me before leaving!"
+ " Or else Imma forget all about your sorry donkey!";
String[] commandParts = input.split(" ");
intlength = input.length();
if (!contains((commandParts[0].toUpperCase()))) {
thrownewShnoopException(improperInput);
}
Commandscommand = Commands.valueOf(commandParts[0].toUpperCase());
switch (command) {
caseLIST:
if (commandParts.length >= 2) {
try {
returnnewListCommand(Integer.parseInt(commandParts[1]));
} catch (NumberFormatExceptione) {
thrownewShnoopException(improperInput);
}
}
if (commandParts[0].toLowerCase().equals("list")
|| commandParts[0].toLowerCase().equals("list ")
|| (length >= 5 && isEmptyFromIdx(5, input))
|| (commandParts.length >= 2 && commandParts[1].isEmpty())) {
returnnewListCommand();
}
caseTODO:
try {
if (!startsWithTodo(input, length) || isEmptyFromIdx(5, input)
|| commandParts[1].isEmpty()) {
thrownewShnoopException(improperInput);
}
returnnewAddCommand(input, Commands.TODO);
} catch (ArrayIndexOutOfBoundsExceptione) {
thrownewShnoopException(improperInput);
}
caseDEADLINE:
try {
if (!startsWithDeadline(input, length) || isEmptyFromIdx(9, input)
|| commandParts[1].isEmpty()) {
thrownewShnoopException(improperInput);
}
returnnewAddCommand(input, Commands.DEADLINE);
} catch (ArrayIndexOutOfBoundsExceptione) {
thrownewShnoopException(improperInput);
}
caseEVENT:
try {
if (!startsWithEvent(input, length) || isEmptyFromIdx(6, input)
|| commandParts[1].isEmpty()) {
thrownewShnoopException(improperInput);
}
returnnewAddCommand(input, Commands.EVENT);
} catch (ArrayIndexOutOfBoundsExceptione) {
thrownewShnoopException(improperInput);
}
caseFIND:
if (isInvalidCommand(length, 6, 5, input, commandParts)) {
thrownewShnoopException(improperInput);
}
returnnewFindCommand(input);
caseDELETE:
if (isInvalidCommand(length,8, 7, input, commandParts, true)) {
thrownewShnoopException(improperInput);
}
returnnewDeleteCommand(input);
caseMARK:
if (isInvalidCommand(length, 6, 5, input, commandParts, true)) {
thrownewShnoopException(improperInput);
}
returnnewMarkCommand(input, true);
caseUNMARK:
if (isInvalidCommand(length, 8, 7, input, commandParts, true)) {
thrownewShnoopException(improperInput);
}
returnnewMarkCommand(input, false);
caseBYE:
returnnewExitCommand();
default:
thrownewShnoopException(improperInput);
}
}
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
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message
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:
@Nigeltzy 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
Example from
src/main/java/shnoop/command/MarkCommand.java
lines16-16
:Example from
src/main/java/shnoop/ui/Parser.java
lines152-152
: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/shnoop/ui/Parser.java
lines185-274
: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
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message
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: