thisisdax / ip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-tic4001-ay2122s1/ip
This project forked from nus-tic4001-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, 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/duke/Parser.java
lines 30-128
:
public void parse(String input) throws DukeException {
this.text = input.split(" ");
String date = "";
switch (text[0].toLowerCase()) {
case "bye":
this.setExit();
this.isTask = false;
break;
case "list":
Ui.printList();
this.isTask = false;
break;
case "todo":
this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length));
try {
this.addTodo(this.body);
this.isTask = true;
} catch (DukeException e) {
e.printErrorMessage();
this.isTask = false;
}
break;
case "deadline":
this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length-2));
date = String.join(" ", Arrays.copyOfRange(text, text.length-2, text.length));
try {
this.addDeadline(this.body, date);
this.isTask = true;
} catch (DukeException e) {
e.printErrorMessage();
this.isTask = false;
}
break;
case "event":
this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length-3));
date = String.join(" ", Arrays.copyOfRange(text, text.length-3, text.length-1));
try {
this.addEvent(this.body, date, text[text.length-1]);
this.isTask = true;
} catch (DukeException e) {
e.printErrorMessage();
this.isTask = false;
}
break;
case "delete":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a task to delete!");
}
try {
int index = Integer.parseInt(text[1]);
if (index > todoList.size()) {
Ui.specifyValidNumber();
this.body = "";
this.isTask = false;
break;
}
if (index > 0) {
Ui.removedTask(todoList.remove(index - 1).toString());
this.isTask = false;
}
} catch (NumberFormatException e ) {
throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
}
break;
case "find":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a word to find!");
}
Ui.searchList(text[1]);
this.body = "";
this.isTask = false;
break;
case "done":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a task to be marked as done!");
}
try {
int index = Integer.parseInt(text[1]);
if (index > todoList.size()) {
Ui.specifyValidNumber();
this.body = "";
this.isTask = false;
break;
}
if (index > 0) {
todoList.get(index - 1).markAsDone();
Ui.markAsDone(todoList.get(index - 1).toString());
this.isTask = false;
}
} catch (NumberFormatException e ) {
throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
}
break;
default:
this.body = "";
this.isTask = false;
throw new DukeException("\t☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
}
}
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
[email protected]
if you want to follow up on this post.
@thisisdax 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/seedu/duke/Parser.java
lines 30-149
:
public void parse(String input) throws DukeException {
this.text = input.split(" ");
String date;
switch (text[0].toLowerCase()) {
case "bye":
this.setExit();
this.isTask = false;
break;
case "list":
Ui.printList();
this.isTask = false;
break;
case "todo":
this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length));
try {
this.addTodo(this.body);
this.isTask = true;
} catch (DukeException e) {
e.printErrorMessage();
this.isTask = false;
}
break;
case "deadline":
this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length - 2));
date = String.join(" ", Arrays.copyOfRange(text, text.length - 2, text.length));
try {
this.addDeadline(this.body, date);
this.isTask = true;
} catch (DukeException e) {
e.printErrorMessage();
this.isTask = false;
}
break;
case "event":
this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length - 3));
date = String.join(" ", Arrays.copyOfRange(text, text.length - 3, text.length - 1));
try {
this.addEvent(this.body, date, text[text.length - 1]);
this.isTask = true;
} catch (DukeException e) {
e.printErrorMessage();
this.isTask = false;
}
break;
case "delete":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a task to delete!");
}
try {
int index = Integer.parseInt(text[1]);
if (index > todoList.size()) {
Ui.specifyValidNumber();
this.body = "";
this.isTask = false;
break;
}
if (index > 0) {
Ui.removedTask(todoList.remove(index - 1).toString());
this.isTask = false;
}
} catch (NumberFormatException e) {
throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
}
break;
case "find":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a word to find!");
}
Ui.searchList(text[1]);
this.body = "";
this.isTask = false;
break;
case "update":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a task to update!");
}
try {
int index = Integer.parseInt(text[1]);
if (index > todoList.size()) {
Ui.specifyValidNumber();
this.body = "";
this.isTask = false;
break;
}
if (index > 0) {
this.updateTask(index, text);
Ui.updateTask(todoList.get(index - 1).toString());
this.isTask = false;
}
} catch (NumberFormatException e) {
throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
}
break;
case "done":
if (text[1].isEmpty() || text[1].isBlank()) {
throw new DukeException("\t☹ OOPS!!! Please specify a task to be marked as done!");
}
try {
int index = Integer.parseInt(text[1]);
if (index > todoList.size()) {
Ui.specifyValidNumber();
this.body = "";
this.isTask = false;
break;
}
if (index > 0) {
todoList.get(index - 1).markAsDone();
Ui.markAsDone(todoList.get(index - 1).toString());
this.isTask = false;
}
} catch (NumberFormatException e) {
throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
}
break;
default:
this.body = "";
this.isTask = false;
throw new DukeException("\t☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
}
}
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
possible problems in commit 38cecc2
:
removed i/o redirection test
possible problems in commit a3df916
:
fixed checkstyle error
possible problems in commit 8323198
:
A-CI
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
No easy-to-detect issues
[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.