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.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
No easy-to-detect issues 👍
Aspect: Brace Style
No easy-to-detect issues 👍
Aspect: Package Name Style
No easy-to-detect issues 👍
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
Example from src/main/java/duke/Deadline.java lines 41-41:
// public Deadline updateDate(String by) {
Example from src/main/java/duke/Deadline.java lines 42-42:
// return new Deadline(this.description, by);
Example from src/main/java/duke/Deadline.java lines 43-43:
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from src/main/java/duke/Duke.java lines 69-134:
public void start(Stage stage) {
scrollPane = new ScrollPane();
dialogContainer = new VBox();
scrollPane.setContent(dialogContainer);
userInput = new TextField();
sendButton = new Button("Send");
AnchorPane mainLayout = new AnchorPane();
mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
scene = new Scene(mainLayout);
stage.setScene(scene);
stage.show();
stage.setTitle("Duke");
stage.setResizable(false);
stage.setMinHeight(600.0);
stage.setMinWidth(400.0);
mainLayout.setPrefSize(400.0, 600.0);
scrollPane.setPrefSize(385, 535);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
scrollPane.setVvalue(1.0);
scrollPane.setFitToWidth(true);
// You will need to import `javafx.scene.layout.Region` for this.
dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);
userInput.setPrefWidth(325.0);
sendButton.setPrefWidth(55.0);
AnchorPane.setTopAnchor(scrollPane, 1.0);
AnchorPane.setBottomAnchor(sendButton, 1.0);
AnchorPane.setRightAnchor(sendButton, 1.0);
AnchorPane.setLeftAnchor(userInput , 1.0);
AnchorPane.setBottomAnchor(userInput, 1.0);
sendButton.setOnMouseClicked((event) -> {
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
userInput.setOnAction((event) -> {
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
sendButton.setOnMouseClicked((event) -> {
handleUserInput();
});
userInput.setOnAction((event) -> {
handleUserInput();
});
}
Example from src/main/java/duke/Ui.java lines 21-79:
public String run(Storage storage, String input) throws DukeException {
ArrayList<Task> list = storage.load();
String parsedInput = Parser.parse(input);
try {
if (parsedInput.equals("list")) {
return getListString(list);
} else if (parsedInput.equals("done")) {
if (input.replaceAll("\\s", "").length() == 4) {
throw new DukeException(DukeException.Type.EmptyDone);
} else {
String modInput = input.replaceAll("\\s", "");
int index = Integer.parseInt(modInput.substring(modInput.length() - 1)) - 1;
if (list.size() <= index) {
throw new DukeException(DukeException.Type.InvalidTaskNumber);
} else {
return getTaskDoneString(list, index, storage);
}
}
} else if (parsedInput.equals("delete")) {
if (input.replaceAll("\\s", "").length() == 6) {
throw new DukeException(DukeException.Type.EmptyDelete);
} else {
return getDeleteTaskString(list, input, storage);
}
} else if (parsedInput.equals("todo")) {
if (input.replaceAll("\\s", "").length() == 4) {
throw new DukeException(DukeException.Type.EmptyTodo);
} else {
return getNewTodoString(list, input, storage);
}
} else if (parsedInput.equals("event")) {
if (input.replaceAll("\\s", "").length() == 5) {
throw new DukeException(DukeException.Type.EmptyEvent);
} else {
return getNewEventString(list, input, storage);
}
} else if (parsedInput.equals("deadline")) {
if (input.replaceAll("\\s", "").length() == 8) {
throw new DukeException(DukeException.Type.EmptyDeadline);
} else {
return getNewDeadlineString(list, input, storage);
}
} else if (parsedInput.equals("find")) {
return getFindString(list, input);
} else if (parsedInput.equals("update")) {
if (input.replaceAll("\\s", "").length() == 6) {
throw new DukeException(DukeException.Type.EmptyUpdate);
} else {
return getUpdateString(list, input);
}
} else if (parsedInput.equals("InvalidCommand")) {
throw new DukeException(DukeException.Type.InvalidCommand);
}
} catch (DukeException e) {
return e.getMessage();
}
storage.save(list);
return parsedInput;
}
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.
Aspect: Header Comments
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message (Subject Only)
possible problems in commit 472fac4:
added update function
- Not in imperative mood (?)
Suggestion: Follow the given conventions for Git commit messages
ℹ️ 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 three example are given i.e., there can be other areas/places to improve.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
No easy-to-detect issues 👍
Aspect: Brace Style
No easy-to-detect issues 👍
Aspect: Package Name Style
No easy-to-detect issues 👍
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
Example from
src/main/java/duke/Deadline.javalines41-41:// public Deadline updateDate(String by) {Example from
src/main/java/duke/Deadline.javalines42-42:// return new Deadline(this.description, by);Example from
src/main/java/duke/Deadline.javalines43-43:// }Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/duke/Duke.javalines69-134:Example from
src/main/java/duke/Ui.javalines21-79: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.
Aspect: Header Comments
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message (Subject Only)
possible problems in commit
472fac4:added update functionSuggestion: Follow the given conventions for Git commit messages
ℹ️ 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.