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
@whitesnowx 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)
publicstaticvoidmain(String[] args) throwsException{
StringNAME = "Luna"; // TENTATIVEBufferedReaderbr = newBufferedReader(newInputStreamReader(System.in));
bot_functions.shifted_print(bot_functions.greetingString(NAME));
booleanexitFlag = false;
commandHintscurrentHint = commandHints.EXIT;
ArrayList<list_Entry> user_list = newArrayList<>();
while (!exitFlag) {
Stringinput_command = br.readLine();
if (input_command.equalsIgnoreCase("help")) {
switch(currentHint) {
caseLIST:
bot_functions.shifted_print("To display all the task in your list\n--> Type: list");
break;
caseTODO:
bot_functions.shifted_print("To add a to-do task to your list\n--> Type: todo <task name>");
break;
caseDEADLINE:
bot_functions.shifted_print("To add a deadline task to your list\n--> Type: deadline <task name> <end date>");
break;
caseEVENT:
bot_functions.shifted_print("To add a event task to your list\n--> Type: event <task name> <start date> <end date>");
break;
caseMARK:
bot_functions.shifted_print("To mark a task as done\n--> Type: mark <list num>");
// break;// case UNMARK:bot_functions.shifted_print("To unmark a task as not done\n--> Type: unmark <list num>");
// break;// case DELETE:bot_functions.shifted_print("To delete a task from the list\n--> Type: delete <list num>");
break;
caseEXIT:
bot_functions.shifted_print("End the program :(\n--> Type: bye");
break;
}
}
// IF EXITif (input_command.equalsIgnoreCase("bye") || input_command.equalsIgnoreCase("exit")) {
bot_functions.shifted_print(bot_functions.signoffString());
exitFlag = true;
// IF LIST IS REQUESTED
} elseif (input_command.equalsIgnoreCase("list")){
currentHint = commandHints.LIST;
StringBuildertext = newStringBuilder();
if (user_list.isEmpty()) {
text.append("List is Empty");
} else {
text.append("These are your outstanding tasks\n");
for (inti = 0; i < user_list.size(); i++) {
list_Entryent = user_list.get(i);
text.append((i+1)).append(".").append(ent.toString()).append("\n");
}
}
bot_functions.shifted_print(text.toString());
} else {
currentHint = commandHints.MARK;
String [] keys = input_command.split(" ", 2);
if (keys[0].equalsIgnoreCase("unmark") || keys[0].equalsIgnoreCase("mark") || keys[0].equalsIgnoreCase("delete")) {
if (Arrays.asList(keys).size() < 2) {
bot_functions.shifted_print("Missing inputs");
} elseif (!bot_functions.isNumeric(keys[1])) {
bot_functions.shifted_print("Please input a number after the command E.g (mark/unmark/delete) 3");
} else {
intpos = Integer.parseInt(keys[1]);
if (pos <= user_list.size() && pos > 0) {
list_Entryent = user_list.get(pos-1);
if (keys[0].equalsIgnoreCase("delete")) {
user_list.remove(pos-1);
bot_functions.shifted_print("Deleting the following task:\n " + ent
+ "\nThere are " + user_list.size() + " tasks in the list");
}
elseif (keys[0].equalsIgnoreCase("mark")) {
ent.markEntry();
bot_functions.shifted_print("Nice! I've marked this task as done:\n" + ent);
} else {
ent.unmarkEntry();
bot_functions.shifted_print("Nice! I've marked this task as not done yet:\n" + ent);
}
} else {
bot_functions.shifted_print("There are " + user_list.size() + " tasks in the list");
}
}
} else {
currentHint = commandHints.TODO;
booleansuccessFlag = false;
list_Entryent = newlist_Entry();
if (Arrays.asList(keys).size() == 2) {
if (keys[0].equalsIgnoreCase("todo")) {
successFlag = true;
ent = newlist_Entry_Todo(keys[1], false);
} elseif (keys[0].equalsIgnoreCase("deadline")) {
currentHint = commandHints.DEADLINE;
String[] keys_entry = keys[1].split(" /by ", 2);
if (Arrays.asList(keys_entry).size() == 2) {
successFlag = true;
ent = newlist_Entry_Deadline(keys_entry[0], false, keys_entry[1]);
}
} elseif (keys[0].equalsIgnoreCase("event")) {
currentHint = commandHints.EVENT;
String[] keys_entry1 = keys[1].split(" /from ", 2);
if (Arrays.asList(keys_entry1).size() == 2) {
String[] keys_entry2 = keys_entry1[1].split(" /to ", 2);
if (Arrays.asList(keys_entry2).size() == 2) {
successFlag = true;
ent = newlist_Entry_Event(keys_entry1[0], false, keys_entry2[0], keys_entry2[1]);
}
}
}
}
if (successFlag) {
user_list.add(ent);
StringBuildertext = newStringBuilder();
Stringcount_msg = "okie! Added a task to the list:\n " + ent + "\nNow you have " + user_list.size() + " tasks in the list.";
text.append(count_msg);
bot_functions.shifted_print(text.toString());
} else {
bot_functions.shifted_print("Wrong format");
}
}
}
}
System.exit(0);
}
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.
Level 5 - Completed
--> Same as Level 4
--> already have some error handling
--> can come back to stretch goals)
(different types of errors)
No Warnings! (typos tho)
No blank line between subject and body
Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
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:
@whitesnowx 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.java
lines22-22
:Example from
src/main/java/Duke.java
lines111-111
:Example from
src/main/java/list_Entry.java
lines8-8
: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
Example from
src/main/java/list_Entry.java
lines1-1
:Example from
src/main/java/list_Entry_Deadline.java
lines1-1
:Example from
src/main/java/list_Entry_Event.java
lines1-1
:Suggestion: Follow the class naming convention specified by the coding standard.
Aspect: Dead Code
Example from
src/main/java/Duke.java
lines44-44
:// break;
Example from
src/main/java/Duke.java
lines47-47
:// break;
Example from
src/main/java/Duke.java
lines198-198
:// output = new String(output + " " + readText + "\n");
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/Duke.java
lines17-153
: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
possible problems in commit
0a71c2c
:possible problems in commit
ebe13f5
:possible problems in commit
06ea13b
:Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
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: