smanmos / 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
No easy-to-detect issues ๐
Example from src/main/java/duke/Parser.java
lines 15-77
:
public static Command parse(String command) {
String[] tokens = command.split(" ");
try {
if (tokens.length == 0){
throw new IllegalArgumentException("Command cannot be empty");
} else if (tokens[0].equals("todo")) {
if (tokens.length == 1) {
throw new IllegalArgumentException("ToDo must have a name");
} else {
String taskName = String.join(" ",
Arrays.copyOfRange(tokens, 1, tokens.length));
return new CommandAdd(new ToDo(taskName));
}
} else if (tokens[0].equals("event")) {
if (tokens.length == 1) {
throw new IllegalArgumentException("ToDo must have a name");
} else {
int atIdx = Arrays.asList(tokens).indexOf("/at");
if (atIdx == -1) {
throw new IllegalArgumentException("Event must be at a certain time");
} else if (atIdx == 1) {
throw new IllegalArgumentException("Event must have a name");
} else {
String taskName = String.join(" ",
Arrays.copyOfRange(tokens, 1, atIdx));
String timeStr = String.join(" ",
Arrays.copyOfRange(tokens, atIdx + 1, tokens.length));
return new CommandAdd(new Event(taskName, timeStr));
}
}
} else if (tokens[0].equals("deadline")) {
int byIdx = Arrays.asList(tokens).indexOf("/by");
if (byIdx == -1) {
throw new IllegalArgumentException("Deadline must be by a certain time");
} else if (byIdx == 1) {
throw new IllegalArgumentException("Deadline must have a name");
} else {
String taskName = String.join(" ",
Arrays.copyOfRange(tokens, 1, byIdx));
String timeStr = String.join(" ",
Arrays.copyOfRange(tokens, byIdx + 1, tokens.length));
return new CommandAdd(new Deadline(taskName, timeStr));
}
} else if (tokens[0].equals("list")) {
return new CommandShowList();
} else if (tokens[0].equals("delete")) {
String taskName = String.join(" ", Arrays.copyOfRange(tokens, 1, tokens.length));
return new CommandDelete(taskName);
} else if (tokens[0].equals("done")) {
String taskName = String.join(" ", Arrays.copyOfRange(tokens, 1, tokens.length));
return new CommandDone(taskName);
} else if (tokens[0].equals("exit")) {
return new CommandExit();
} else if (tokens[0].equals("find")) {
String keyword = String.join(" ", Arrays.copyOfRange(tokens, 1, tokens.length));
return new CommandFind(keyword);
} else {
throw new IllegalArgumentException("Command not recognised");
}
} catch (IllegalArgumentException ex) {
return new CommandError(ex.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.
Example from src/main/java/duke/Task.java
lines 43-45
:
/**
* Mark this task as finished
*/
Example from src/main/java/duke/Task.java
lines 56-59
:
/**
* Whether this Task is timed or not
* @return <code>isTimed</code>
*/
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
[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/duke/Duke.java
lines 34-37
:
/**
* 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
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.