jianyangg / ip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-cs2103-ay2324s1/ip
This project forked from nus-cs2103-ay2324s1/ip
@jianyangg 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 ๐
Example from src/main/java/duke/Task.java
lines 9-9
:
private boolean prioritySet;
Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/duke/TaskList.java
lines 25-25
:
// this.taskList.addAll(savedTaskList);
Example from src/main/java/duke/Ui.java
lines 22-22
:
// System.out.println("\nWelcome to Chatty.\n" + LOGO);
Example from src/main/java/duke/Ui.java
lines 26-26
:
// private String sendGreeting() {
Suggestion: Remove dead code from the codebase.
Example from src/main/java/duke/Duke.java
lines 74-177
:
private String handleTextInput(String inputString) {
assert inputString != null : "Input string cannot be null";
assert !inputString.isEmpty() : "Input string cannot be empty";
// handle key logic here.
String command = inputString.split(" ")[0];
int taskIndex;
switch (command) {
case "bye":
return ui.sendFarewell();
case "list":
return ui.printTaskList(tasks.toString());
case "mark":
// taskIndex is the second word in the input string
taskIndex = Integer.parseInt(inputString.split(" ")[1]) - 1;
tasks.markTaskAsDone(taskIndex);
return ui.markTaskAsDoneMessage(tasks.taskToString(taskIndex));
case "unmark":
taskIndex = Integer.parseInt(inputString.split(" ")[1]) - 1;
tasks.unmarkTaskAsDone(taskIndex);
return ui.unmarkTaskAsDoneMessage(tasks.taskToString(taskIndex));
case "todo":
try {
String taskName = inputString.substring(5);
Task newTask = new ToDo(taskName);
tasks.addToTaskList(newTask);
assert !tasks.isEmpty() : "Task list should not be empty";
return ui.addTaskOutputText(newTask, tasks.size());
} catch (StringIndexOutOfBoundsException e) {
return ui.showErrorMessage("\tโน OOPS!!! The description of a todo cannot be empty.");
}
case "deadline":
try {
// stop before /by
String taskName = inputString.substring(9, inputString.indexOf("/by") - 1);
// get day
String deadline = inputString.substring(inputString.indexOf("/by") + 4);
try {
Task newTask = new Deadline(taskName, deadline);
tasks.addToTaskList(newTask);
return ui.addTaskOutputText(newTask, tasks.size());
} catch (java.time.format.DateTimeParseException e) {
return ui.showErrorMessage("\tInvalid date format. Please use yyyy-mm-dd.");
}
} catch (StringIndexOutOfBoundsException e) {
return ui.showErrorMessage("\tโน OOPS!!! The description of a deadline cannot be empty.");
}
case "event":
try {
String taskName = inputString.substring(6, inputString.indexOf("/from") - 1);
String from = inputString.substring(inputString.indexOf("/from") + 6, inputString.indexOf("/to") - 1);
String to = inputString.substring(inputString.indexOf("/to") + 4);
Task newTask = new Event(taskName, from, to);
tasks.addToTaskList(newTask);
return ui.addTaskOutputText(newTask, tasks.size());
} catch (StringIndexOutOfBoundsException e) {
return ui.showErrorMessage("\tโน OOPS!!! The description of an event cannot be empty.");
}
case "delete":
taskIndex = Integer.parseInt(inputString.split(" ")[1]) - 1;
String msg = ui.printDeleteMessage(tasks.taskToString(taskIndex), taskIndex, tasks.size());
tasks.deleteTask(taskIndex);
return msg;
case "find":
String keyword = inputString.substring(5);
String outputString = "";
for (int i = 0; i < tasks.size(); i++) {
if (tasks.taskToString(i).contains(keyword)) {
outputString += tasks.taskToString(i) + "\n";
}
}
return ui.printTaskList(outputString);
case "priority":
// the format will be priority <index> <priority>
// priority is an integer
// index is an integer
// priority is between 1 and 5
// index is between 1 and taskList.size()
String[] inputArr = inputString.split(" ");
int priority = Integer.parseInt(inputArr[2]);
taskIndex = Integer.parseInt(inputArr[1]) - 1;
tasks.setPriority(taskIndex, priority);
return ui.printPriorityMessage(tasks.taskToString(taskIndex), priority);
default:
return ui.showErrorMessage(
"\tโน OOPS!!! I'm sorry, but I don't know what that means. Try again using either mark <index>,"
+ "unmark <index>, todo <task>, deadline <task /by ..>, event <task /from .. /to ..>, or bye.");
}
}
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 ๐
No easy-to-detect issues ๐
possible problems in commit 746fb28
:
Add C-Priority extension to Duke
Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority
Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority
possible problems in commit 351d80f
:
Add assertions where appropriate to validate function arguments
The addition of these assertions should help us validate our assumptions,
thus making it easier for errors and bugs to be detected.
As there are not much logic involved in this project, focus is mainly placed
on validating the input to the functions
The addition of these assertions should help us validate our assumptions,
possible problems in commit 6e89ab7
:
Improve the code quality in accordance with the CS2103T textbook
Code quality were improved with respect to areas such as comments,
line spacing to separate groups of related statements,
and avoided complicated expressions by breaking them down into simpler logic blocks
and avoided complicated expressions by breaking them down into simpler logic blocks
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.
@jianyangg 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 ๐
Example from src/main/java/duke/gui/MainWindow.java
lines 71-71
:
// dialogContainer.getChildren().add(DialogBox.getDukeDialog("Exiting in 2 seconds", dukeImage));
Suggestion: Remove dead code from the codebase.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
possible problems in commit 1c038e7
:
Create a JAR file for the latest Chatty version.
JAR file should not actually be included here.
It'll be released instead as v0.2
possible problems in commit b558549
:
Added Chatty name website User Guide title
possible problems in commit 746fb28
:
Add C-Priority extension to Duke
Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority
Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority
Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
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.
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.