@iapetusbob 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
Example from src/main/java/DOOK.java lines 87-88:
Suggestion: As specified by the coding standard, use egyptian style braces.
Aspect: Package Name Style
Example from src/main/java/DukeHelpfulCode/Commands/AddCommand.java lines 1-1:
package DukeHelpfulCode.Commands;
Example from src/main/java/DukeHelpfulCode/Commands/Command.java lines 1-1:
package DukeHelpfulCode.Commands;
Example from src/main/java/DukeHelpfulCode/Commands/DeleteCommand.java lines 1-1:
package DukeHelpfulCode.Commands;
Suggestion: Follow the package naming convention specified by the coding standard.
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
Example from src/test/java/DOOKTest.java lines 1-1:
Example from src/test/java/ExceptionTest.java lines 1-1:
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from src/main/java/DukeHelpfulCode/Utilities/Parser.java lines 16-162:
public static Command parse(String fullCommand) throws NoTaskTypeException, NoTaskNameException, NoDueTimeException, NoStartTimeException, NoEndTimeException, NoSuchTaskException {
/**
* Converts the user input into a Command.
*
* @param fullCommand The user input
* @return command The Command that the user wants
* @throws NoTaskTypeException Thrown if parser does not find the task type if adding
* @throws NoTaskNameException Thrown if parser does not find the task name if adding
* @throws NoDueTimeException Thrown if parser does not find the due dateTime if adding deadline
* @throws NoStartTimeException Thrown if parser does not find the start dateTime if adding event
* @throws NoEndTimeException Thrown if parser does not find the end dateTime if adding event
* @throws NoSuchTaskException Thrown if deleting/marking task that isnt there on the list
*/
Command cmd = new HelpCommand();
String[] cmdArr = fullCommand.split(" ");
if (cmdArr.length == 1 && cmdArr[0].equals("bye")){
cmd = new ExitCommand();
return cmd;
} else if (cmdArr.length == 1 && cmdArr[0].equals("help")){
cmd = new HelpCommand();
return cmd;
} else if (cmdArr.length == 1 && cmdArr[0].equals("list")){
cmd = new ListCommand();
return cmd;
}
// check for task type, task name, start end due datetime
// input will be in the form of:
// >bye
// >help
// >add event name /from sdt /to edt
// >mark 1 -> first item so 0th index
// >unmark 1 -> first item so 0th index
// >delete 1 -> first item to 0th index
if (cmdArr[0].equals("add")){
String[] taskTypes = {"todo", "event", "deadline"};
String taskName = "";
Task task;
// no task name
// if deadline -> no due time
// if event -> no sdt or no edt
if (cmdArr.length == 1){
throw new NoTaskTypeException();
} else if (cmdArr.length == 2){
if (!Arrays.asList(taskTypes).contains(cmdArr[1])){
throw new NoTaskTypeException();
} else {
throw new NoTaskNameException();
}
} else {
if (cmdArr[1].equals("todo")){
for (int i = 2; i < cmdArr.length; i++){
taskName += cmdArr[i];
}
task = new Todo(taskName);
} else if (cmdArr[1].equals("deadline")) {
// >add deadline name /by dueDate
if (!Arrays.asList(cmdArr).contains("/by")) {
throw new NoDueTimeException();
} else if(cmdArr[2].equals("/by")){
throw new NoTaskNameException();
} else {
int by = Arrays.asList(cmdArr).indexOf("/by");
for (int i = 2; i < by; i++) {
taskName += cmdArr[i];
}
String dt = "";
for (int i = by + 1; i < cmdArr.length; i++){
dt += cmdArr[i] + " ";
}
task = new Deadline(taskName,dt.substring(0,dt.length()-1));
}
} else if (cmdArr[1].equals("event")){
// >add event name /from sdt /to edt
if (!Arrays.asList(cmdArr).contains("/from")) {
throw new NoStartTimeException();
} else if(!Arrays.asList(cmdArr).contains("/to")){
throw new NoEndTimeException();
} else if(cmdArr[2].equals("/from")){
throw new NoTaskNameException();
} else {
int start = Arrays.asList(cmdArr).indexOf("/from");
int end = Arrays.asList(cmdArr).indexOf("/to");
for (int i = 2; i < start; i++) {
taskName += cmdArr[i];
}
String sdt = "";
for (int i = start + 1; i < end; i++){
sdt += cmdArr[i] + " ";
}
String edt = "";
for (int i = end + 1; i < cmdArr.length; i++){
edt += cmdArr[i];
}
task = new Event(taskName, sdt.substring(0,sdt.length()-1), edt.substring(0,edt.length()-1));
}
} else {
throw new NoTaskTypeException();
}
}
cmd = new AddCommand(task);
} else if (cmdArr[0].equals("delete")){
int taskNum;
try {
taskNum = Integer.parseInt(cmdArr[1]);
} catch (NumberFormatException e) {
throw new NoSuchTaskException();
}
cmd = new DeleteCommand(taskNum);
} else if (cmdArr[0].equals("mark")){
boolean isMark = true;
int taskNum;
try {
taskNum = Integer.parseInt(cmdArr[1]);
} catch (NumberFormatException e) {
throw new NoSuchTaskException();
}
cmd = new MarkCommand(isMark, taskNum);
} else if (cmdArr[0].equals("unmark")){
boolean isMark = false;
int taskNum;
try {
taskNum = Integer.parseInt(cmdArr[1]);
} catch (NumberFormatException e) {
throw new NoSuchTaskException();
}
cmd = new MarkCommand(isMark, taskNum);
// mark command in tasklist need to change from unmark and mark to this boolean
}
return cmd;
}
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/DOOK.java lines 75-78:
/**
* You should have your own function to generate a response to user input.
* Replace this stub with your completed method.
*/
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 f292f45:
UG
possible problems in commit 8b39140:
L4
possible problems in commit cd0cdf7:
jar
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
Aspect: Binary files in repo
Suggestion: Avoid committing binary files (e.g., *.class, *.jar, *.exe) or third-party library files in to the repo.
❗ 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 cs2103@comp.nus.edu.sg if you want to follow up on this post.
@iapetusbob 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
Example from
src/main/java/DOOK.javalines87-88:} else {Suggestion: As specified by the coding standard, use egyptian style braces.
Aspect: Package Name Style
Example from
src/main/java/DukeHelpfulCode/Commands/AddCommand.javalines1-1:Example from
src/main/java/DukeHelpfulCode/Commands/Command.javalines1-1:Example from
src/main/java/DukeHelpfulCode/Commands/DeleteCommand.javalines1-1:Suggestion: Follow the package naming convention specified by the coding standard.
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
Example from
src/test/java/DOOKTest.javalines1-1:// package ;Example from
src/test/java/ExceptionTest.javalines1-1:// package ;Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/DukeHelpfulCode/Utilities/Parser.javalines16-162: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/DOOK.javalines75-78: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
f292f45:UGpossible problems in commit
8b39140:L4possible problems in commit
cd0cdf7:jarSuggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
Aspect: Binary files in repo
src\main\java\DukeHelpfulCode\Commands\AddCommand.classsrc\main\java\DukeHelpfulCode\Commands\Command.classsrc\main\java\DukeHelpfulCode\Commands\DeleteCommand.classSuggestion: Avoid committing binary files (e.g.,
*.class,*.jar,*.exe) or third-party library files in to the repo.❗ 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
cs2103@comp.nus.edu.sgif you want to follow up on this post.