reneeyeow02 / ip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-cs2103-ay2223s1/ip
This project forked from nus-cs2103-ay2223s1/ip
@reneeyeow02 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.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/meowmeow/Parser.java
lines 19-108
:
public static Command parse(String userInput) {
userInput = userInput.trim();
String[] splitUI = userInput.split(" ");
assert splitUI.length > 0 : "splitUI should not be empty";
switch (splitUI[0]) {
case "hi":
return new HiCommand();
case "list":
return new ListCommand();
case "bye":
return new ExitCommand();
case "undo":
return new UndoCommand();
default:
break;
}
String[] splitUserInput = userInput.split(" ", 2);
String cmdWord = splitUserInput[0];
switch (cmdWord) {
case "mark":
try {
int taskNum = Integer.parseInt(splitUserInput[1]);
return new MarkCommand(true, taskNum);
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= Meowmeow needs a number for the task you want to mark!");
}
case "unmark":
try {
int taskNum = Integer.parseInt(splitUserInput[1]);
return new MarkCommand(false, taskNum);
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= Meowmeow needs a number for the task you want to unmark!");
}
case "todo":
try {
String taskName = splitUserInput[1];
return new AddCommand('T', taskName);
} catch (ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= Meowmeow needs a name for the todo you want to add!");
}
case "deadline":
try {
String nameAndLocalDateTime = splitUserInput[1];
return new AddCommand('D', nameAndLocalDateTime);
} catch (ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= To add a deadline type it in in this format: "
+ "deadline (name) /by (YYYY-MM-DDTHH:MM:SS)");
}
case "event":
try {
String nameAndTime = splitUserInput[1];
return new AddCommand('E', nameAndTime);
} catch (ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= To add an event type it in in this format: event (name) /at (time)");
}
case "delete":
try {
int taskToDelete = Integer.parseInt(splitUserInput[1]);
return new DeleteCommand(taskToDelete);
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= Meowmeow needs a number for the task you want to delete!");
}
case "find":
try {
String taskToFind = splitUserInput[1];
return new FindCommand(taskToFind);
} catch (ArrayIndexOutOfBoundsException e) {
return new DefaultCommand("=0w0= Meowmeow needs a name for the task you want to find!");
}
default:
return new DefaultCommand("Sowwie meowmeow doesn't understand what you said uwu โฅ \n"
+ "Try typing something else! owo");
}
}
Example from src/main/java/meowmeow/Storage.java
lines 60-127
:
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(" \\| ");
assert split.length > 0 : "Save file is empty";
String firstChar = split[0];
assert firstChar == "T" || firstChar == "D" || firstChar == "E" : "Save file is corrupted";
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.toString());
}
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.
No easy-to-detect issues ๐
Example from src/main/java/meowmeow/Meowmeow.java
lines 24-28
:
/**
* Method that gets the response from the chatbot.
*
* @param input the user input.
*/
Example from src/main/java/meowmeow/events/Task.java
lines 22-24
:
/**
* Method that marks the task as done.
*/
Example from src/main/java/meowmeow/events/Task.java
lines 29-31
:
/**
* Method that marks the task as not done.
*/
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
No easy-to-detect issues ๐
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.
@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.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
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.
No easy-to-detect issues ๐
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.
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).
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.