thesoggy / 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
@TheSoggy 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/Duke.java
lines 18-18
:
private boolean tasksEnd = false;
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 ๐
No easy-to-detect issues ๐
Example from src/main/java/duke/Parser.java
lines 51-150
:
public static Command parseCommand(String input) throws DukeException {
String[] inputs = input.split(" ", 2);
CommandType commandType = CommandType.fromString(inputs[0].toUpperCase());
if (commandType == null) {
throw new DukeException("Invalid command: Please try again.");
}
String description;
switch (commandType) {
case BYE:
return new ByeCommand();
case LIST:
return new ListCommand();
case EMPTY:
return new EmptyCommand();
case MARK:
if (inputs.length == 1) {
throw new DukeException("Wrong number of arguments.");
}
try {
int index = Integer.parseInt(inputs[1]) - 1;
return new SetDoneCommand(index, true);
} catch (NumberFormatException e) {
throw new DukeException("Invalid argument: Index of task should be a number.");
} catch (IndexOutOfBoundsException e) {
throw new DukeException("Invalid argument: Index of task should be between 1 and the number of tasks.");
}
case UNMARK:
if (inputs.length == 1) {
throw new DukeException("Wrong number of arguments.");
}
try {
int index = Integer.parseInt(inputs[1]) - 1;
return new SetDoneCommand(index, false);
} catch (NumberFormatException e) {
throw new DukeException("Invalid argument: Index of task should be a number.");
} catch (IndexOutOfBoundsException e) {
throw new DukeException("Invalid argument: Index of task should be between 1 and the number of tasks.");
}
case TODO:
if (inputs.length == 1) {
throw new DukeException("Wrong number of arguments.");
}
description = inputs[1];
if (description.length() == 0) {
throw new DukeException("Invalid argument: Description cannot be empty.");
}
return new AddTaskCommand(new TodoTask(description, false));
case DEADLINE:
if (inputs.length == 1) {
throw new DukeException("Wrong number of arguments.");
}
try {
description = inputs[1].substring(0, inputs[1].indexOf(" /by "));
if (description.length() == 0) {
throw new DukeException("Invalid argument: Description cannot be empty.");
}
String deadline = inputs[1].substring(inputs[1].indexOf(" /by ") + 5);
if (deadline.length() == 0) {
throw new DukeException("Invalid argument: Deadline cannot be empty.");
}
return new AddTaskCommand(new DeadlineTask(description, Parser.parseDateTime(deadline), false));
} catch (StringIndexOutOfBoundsException e) {
throw new DukeException("Invalid argument: Use /by flag to specify the deadline of the task");
}
case EVENT:
if (inputs.length == 1) {
throw new DukeException("Wrong number of arguments.");
}
try {
description = inputs[1].substring(0, inputs[1].indexOf(" /at "));
if (description.length() == 0) {
throw new DukeException("Invalid argument: Description cannot be empty.");
}
String time = inputs[1].substring(inputs[1].indexOf(" /at ") + 5);
if (time.length() == 0) {
throw new DukeException("Invalid argument: Event time cannot be empty.");
}
return new AddTaskCommand(new EventTask(description, Parser.parseDateTime(time), false));
} catch (StringIndexOutOfBoundsException e) {
throw new DukeException("Invalid argument: Use /at flag to specify the date and time of the event.");
}
case DELETE:
if (inputs.length == 1) {
throw new DukeException("Wrong number of arguments.");
}
try {
int index = Integer.parseInt(inputs[1]) - 1;
return new DeleteTaskCommand(index);
} catch (NumberFormatException e) {
throw new DukeException("Invalid argument: Index of task should be a number.");
} catch (IndexOutOfBoundsException e) {
throw new DukeException("Invalid argument: Index of task should be between 1 and the number of tasks.");
}
default:
throw new DukeException("Invalid command: Please try again.");
}
}
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 ๐
No easy-to-detect issues ๐
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.
@TheSoggy We did an automated analysis of your code to detect potential areas to improve the code quality. The script did not detect any issues in your code (nice!).
IMPORTANT: Note that the script looked for just a few easy-to-detect problems only 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 ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
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.