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 one example is given i.e., there can be other areas/places to improve.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Brace Style
Example from src/main/java/Duke.java lines 41-42:
Suggestion: As specified by the coding standard, use egyptian style braces.
Aspect: Package Name Style
No easy-to-detect issues 👍
Aspect: Class Name Style
Example from src/main/java/dapp.java lines 21-21:
public class dapp extends Application{
Suggestion: Follow the class naming convention specified by the coding standard.
Aspect: Dead Code
Example from src/main/java/ByeCommand.java lines 4-4:
//System.out.println("Bye. Hope to see you again soon!");
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from src/main/java/Storage.java lines 52-101:
public ArrayList<Task> load() throws DukeException.FileLoadError {
ArrayList<Task> loadTasks = new ArrayList<>();
//check whether file exists
File file = new File(this.filePath);
Path path = Paths.get(this.filePath);
if (!file.isFile()) {
createFile(path);
this.load();
} else {
try {
Scanner sc = new Scanner(new File(path.toString()));
while (sc.hasNextLine()) {
String fileLine = sc.nextLine().trim();
if (fileLine.charAt(0) == 'T') {
Todo newTask = new Todo(fileLine.substring(8));
if (fileLine.charAt(4) == '1') {
newTask.markAsDone();
}
loadTasks.add(newTask);
} else if (fileLine.charAt(0) == 'D') {
//index of last "|"
int idx = fileLine.lastIndexOf("|");
Deadlines newTask = new Deadlines(fileLine.substring(8, idx - 1),
fileLine.substring(idx + 2));
if (fileLine.charAt(4) == '1') {
newTask.markAsDone();
}
loadTasks.add(newTask);
} else if (fileLine.charAt(0) == 'E') {
int idx = fileLine.lastIndexOf("|");
Events newTask =
new Events(fileLine.substring(8, idx - 1),
fileLine.substring(idx + 2));
if (fileLine.charAt(4) == '1') {
newTask.markAsDone();
}
loadTasks.add(newTask);
}
}
} catch (FileNotFoundException e) {
throw new DukeException.FileLoadError("File at: "
+ path.toString() + " cannot be read");
}
}
return loadTasks;
}
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.
ℹ️ 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 cs2103@comp.nus.edu.sg 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, 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 one example is given i.e., there can be other areas/places to improve.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Brace Style
Example from
src/main/java/Duke.javalines41-42:} else{Suggestion: As specified by the coding standard, use egyptian style braces.
Aspect: Package Name Style
No easy-to-detect issues 👍
Aspect: Class Name Style
Example from
src/main/java/dapp.javalines21-21:Suggestion: Follow the class naming convention specified by the coding standard.
Aspect: Dead Code
Example from
src/main/java/ByeCommand.javalines4-4://System.out.println("Bye. Hope to see you again soon!");Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/Storage.javalines52-101: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.
ℹ️ 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
cs2103@comp.nus.edu.sgif you want to follow up on this post.