@reneeyeow02 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
No easy-to-detect issues ๐
Aspect: Method Length
Example from src/main/java/meowmeow/Parser.java
lines 17-77
:
public static Command parse(String userInput) {
try {
String[] splitUI = userInput.split(" ");
switch (splitUI[0]) {
case "list":
return new ListCommand();
case "bye":
return new ExitCommand();
default:
break;
}
String[] splitUserInput = userInput.split(" ", 2);
if (splitUserInput.length <= 1) {
throw new MeowmeowException("Sowwie meowmeow doesn't understand what you said uwu");
} else {
String cmdWord = splitUserInput[0];
switch (cmdWord) {
case "mark":
int taskNum = Integer.parseInt(splitUserInput[1]);
return new MarkCommand(true, taskNum);
case "unmark":
taskNum = Integer.parseInt(splitUserInput[1]);
return new MarkCommand(false, taskNum);
case "todo":
String taskName = splitUserInput[1];
return new AddCommand('T', taskName);
case "deadline":
String nameAndLocalDateTime = splitUserInput[1];
return new AddCommand('D', nameAndLocalDateTime);
case "event":
String nameAndTime = splitUserInput[1];
return new AddCommand('E', nameAndTime);
case "delete":
int taskToDelete = Integer.parseInt(splitUserInput[1]);
return new DeleteCommand(taskToDelete);
case "find":
String taskToFind = splitUserInput[1];
return new FindCommand(taskToFind);
default:
return new DefaultCommand();
}
}
} catch (MeowmeowException e) {
System.out.println(e);
}
return new DefaultCommand();
}
Example from src/main/java/meowmeow/Storage.java
lines 60-125
:
public ArrayList<Task> parseSaveFile(File txt) {
try {
txt.getAbsolutePath();
txt.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
Scanner sc = null;
try {
sc = new Scanner(txt);
while (sc.hasNextLine()) {
String text = sc.nextLine();
String[] split = text.split(" \\| ");
String firstChar = split[0];
switch (firstChar) {
case "T":
String taskName = split[2];
Task todo = new ToDo(taskName);
taskList.add(todo);
boolean isDone = Boolean.parseBoolean(split[1]);
if (isDone) {
todo.markAsDone();
}
break;
case "D":
taskName = split[2];
LocalDateTime date = LocalDateTime.parse(split[3]);
Task deadline = new Deadline(taskName, date);
taskList.add(deadline);
isDone = Boolean.parseBoolean(split[1]);
if (isDone) {
deadline.markAsDone();
}
break;
case "E":
taskName = split[2];
String time = split[3];
Task event = new Event(taskName, time);
taskList.add(event);
isDone = Boolean.parseBoolean(split[1]);
if (isDone) {
event.markAsDone();
}
break;
default:
break;
}
}
} catch (FileNotFoundException e) {
System.out.println(e.getMessage());
}
return taskList;
}
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/meowmeow/Meowmeow.java
lines 46-48
:
/**
* Method that runs the program.
*/
Example from src/main/java/meowmeow/Meowmeow.java
lines 66-70
:
/**
* Main method that runs the program.
*
* @param args the command line arguments.
*/
Example from src/main/java/meowmeow/Meowmeow.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 08cacd5
:
JavaFX
possible problems in commit 044d6a1
:
A-Jar
possible problems in commit bc21226
:
A-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
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.