kaixin-hc / ip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-cs2103-ay2122s1/ip
This project forked from nus-cs2103-ay2122s1/ip
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 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 ๐
Example from src/main/java/katheryne/Katheryne.java
lines 27-27
:
// public Katheryne() {
Example from src/main/java/katheryne/Katheryne.java
lines 29-29
:
// }
Example from src/main/java/katheryne/Katheryne.java
lines 77-77
:
// System.out.println("Here's the list I've stored for you:");
Suggestion: Remove dead code from the codebase.
Example from src/main/java/katheryne/Katheryne.java
lines 31-149
:
public static void main(String[] args) {
// initialise variables
Storage storage = new Storage();
Ui ui = new Ui();
TaskList lst = new TaskList();
// initialise Katheryne
try {
storage.loadTasks(lst, "tasks.json");
} catch (KatheryneException e) {
ui.showErrorMessage(e);
}
ui.greet(lst);
Scanner in = new Scanner(System.in);
while (true) {
try {
String userInput = in.nextLine();
String[] keywordInput = userInput.split(" ", 2);
if (userInput.equalsIgnoreCase("BYE")) {
break;
} else if (keywordInput[0].equalsIgnoreCase("done") || keywordInput[0].equalsIgnoreCase("complete")) {
if (keywordInput.length == 1) {
throw new KatheryneException("Traveller, please specify by index which task you completed.");
}
int i = Integer.parseInt(keywordInput[1]);
if (i <= lst.getSize() && i > 0) {
lst.doTask(i - 1);
ui.say("Task done: " + lst.getTask(i - 1));
} else {
throw new KatheryneException("That's not a valid index...");
}
} else if (keywordInput[0].equalsIgnoreCase("delete")) {
if (keywordInput.length == 1) {
throw new KatheryneException("Traveller, please specify by index what I should delete.");
}
int i = Integer.parseInt(keywordInput[1]);
if (i <= lst.getSize() && i > 0) {
System.out.println("Okay, I'll delete the following item:");
System.out.println(lst.deleteTask(i - 1));
} else {
throw new KatheryneException("That's not a valid index...");
}
} else if (userInput.equalsIgnoreCase("list")) {
// return the list of items stored
lst.printList();
// System.out.println("Here's the list I've stored for you:");
// for (int i = 1; i <= lst.size(); i++) {
// System.out.println(i + ") " + lst.get(i - 1));
// }
} else if (keywordInput[0].equalsIgnoreCase("deadline")) {
try {
String[] parsedDeadline = keywordInput[1].split("/by");
if (parsedDeadline[0].isEmpty()) {
throw new KatheryneException(
"A deadline needs a description and a /by time in the format 2007-12-03. The "
+ "description is missing~");
}
if (parsedDeadline.length == 2) {
lst.add(new Deadline(parsedDeadline[0].trim(), LocalDate.parse(parsedDeadline[1].trim())));
} else {
throw new KatheryneException(
"A deadline needs a description and a /by time in the format 2007-12-03.");
}
System.out.println(
"'" + parsedDeadline[0] + "' added to your list, do by " + parsedDeadline[1]);
} catch (DateTimeParseException e) {
throw new KatheryneException(
"The by time is in the wrong format. It must be in the format YYYY-MM-DD");
}
} else if (keywordInput[0].equalsIgnoreCase("event")) {
try {
String[] parsedEvent = keywordInput[1].split(" /at ");
if (parsedEvent[0].isEmpty()) {
throw new KatheryneException(
"An event needs a description and an /at time when it occurs in the format "
+ "2007-12-03. The description is missing");
}
if (parsedEvent.length == 2) {
lst.add(new Event(parsedEvent[0].trim(), LocalDate.parse(parsedEvent[1].trim())));
System.out.println(
"'" + parsedEvent[0] + "' added to your list, scheduled for " + parsedEvent[1]);
} else {
throw new KatheryneException(
"An event needs a description and an /at time when it occurs in the format "
+ "2007-12-03.");
}
} catch (DateTimeParseException e) {
throw new KatheryneException(
"The at time is in the wrong format. It must be in the format YYYY-MM-DD");
}
} else if (keywordInput[0].equalsIgnoreCase("todo")) {
if (keywordInput.length == 1) {
throw new KatheryneException("A todo needs a description ");
} else {
lst.add(new Todo(keywordInput[1].trim()));
System.out.println("Todo item '" + keywordInput[1] + "' added to your list");
}
} else {
throw new UnknownCommandException();
}
System.out.println("There are currently " + lst.getSize() + " items in your list.");
} catch (UnknownCommandException e) {
System.out.println(e.getMessage());
} catch (KatheryneException e) {
System.out.println(e.getMessage());
} catch (NumberFormatException e) {
System.out.println("You need to specify a number in the correct format. ERROR: "
+ e.getMessage());
}
}
// try to save the file
try {
storage.saveTasks(lst,"tasks.json");
} catch (KatheryneException e) {
System.out.println(e.getMessage());
}
}
Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods. You may ignore this suggestion if you think a longer method is justified in a particular case.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
โน๏ธ The bot account @cs2103-bot 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.
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 ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/katheryne/Message.java
lines 66-72
:
/**
* Get confirmation message for adding a deadline.
*
* @param d
* @param lst
* @return
*/
Example from src/main/java/katheryne/Message.java
lines 78-84
:
/**
* Get confirmation message for adding an event.
*
* @param e
* @param lst
* @return
*/
Example from src/main/java/katheryne/Message.java
lines 90-96
:
/**
* Get confirmation message for adding a todo.
*
* @param t
* @param lst
* @return
*/
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 ๐
โ 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 @nus-se-bot 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.