@ji-just-ji 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.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
Example from src/main/java/peko/tasks/Task.java lines 13-13:
protected boolean status;
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)
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/peko/DateTimeHandler.java lines 51-51:
//return dateTimeString + " " + hour + ":" + ((min < 10) ? "0" + min : min);
Example from src/main/java/peko/Launcher.java lines 19-19:
//Application.launch(Main.class, args);
Example from src/main/java/peko/Peko.java lines 46-46:
//Application.launch(GUIController.class, args);
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from src/main/java/peko/GUIController.java lines 60-116:
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("Peko");
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);
dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
sendButton.setOnMouseClicked((event) -> {
handleUserInput();
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
userInput.setOnAction((event) -> {
handleUserInput();
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
}
Example from src/main/java/peko/Peko.java lines 89-152:
public void start(Stage stage) {
//Step 1. Setting up required components
//The container for the content of the chat to scroll.
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("PekoBot");
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();
});
sendButton.setOnMouseClicked((event) -> {
handleUserInput();
});
userInput.setOnAction((event) -> {
handleUserInput();
});
}
Example from src/main/java/peko/tasks/TaskHandler.java lines 174-237:
public String getResponse() {
String out = "Gomen Peko I don't understand";
;
try {
switch (command) {
case ECHO:
out = echo();
break;
case LIST:
out = readArray();
break;
case WRITE:
out = addToArray();
break;
case MARK:
out = mark(description);
break;
case UNMARK:
out = unmark(description);
break;
case TODO:
out = todo(description);
break;
case DEADLINE:
out = deadline(description);
break;
case EVENT:
out = Event(description);
break;
case FIND:
out = Find(description);
break;
case DELETE:
out = delete(description);
break;
case COPYPASTA:
try {
return StorageHandler.degen();
} catch (FileNotFoundException e) {
return "Hentai!";
} finally {
return "Something Went Wrong Peko....";
}
case OTSUPEKO:
SaveHandler.saveTo();
return "";
default:
System.out.println(out);
return out;
}
} catch (InvalidTaskException e) {
System.out.println(e);
return e.toString();
} catch (NumberFormatException e) {
out = ("That's not a number Bakatare!");
return out;
}
System.out.println(out);
return out;
}
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.
Aspect: Class size
No easy-to-detect issues 👍
Aspect: Header Comments
Example from src/main/java/peko/Launcher.java lines 12-16:
/**
* The main method that launches the Peko JavaFX application.
*
* @param args The command-line arguments passed to the application.
*/
Example from src/main/java/peko/Peko.java lines 40-44:
/**
* The main entry point for the Peko application.
*
* @param args Command-line arguments (not used).
*/
Example from src/main/java/peko/commands/Find.java lines 32-35:
/**
* Private method to search for tasks that match the provided search query.
* It populates the {@code tempTaskList} with matching tasks.
*/
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
Aspect: Recent Git Commit Message
possible problems in commit 7f122df:
Added javadocs to ArchiveHandler and Peko
- Not in imperative mood (?)
possible problems in commit 21a2703:
Override equals for Tasks to make sure identicle Tasks are based on task details.
- Longer than 72 characters
- Subject line should not end with a period
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
Aspect: Binary files in repo
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 cs2103@comp.nus.edu.sg if you want to follow up on this post.
@ji-just-ji 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.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
Example from
src/main/java/peko/tasks/Task.javalines13-13: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)
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/peko/DateTimeHandler.javalines51-51://return dateTimeString + " " + hour + ":" + ((min < 10) ? "0" + min : min);Example from
src/main/java/peko/Launcher.javalines19-19://Application.launch(Main.class, args);Example from
src/main/java/peko/Peko.javalines46-46://Application.launch(GUIController.class, args);Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/peko/GUIController.javalines60-116:Example from
src/main/java/peko/Peko.javalines89-152:Example from
src/main/java/peko/tasks/TaskHandler.javalines174-237: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.
Aspect: Class size
No easy-to-detect issues 👍
Aspect: Header Comments
Example from
src/main/java/peko/Launcher.javalines12-16:Example from
src/main/java/peko/Peko.javalines40-44:Example from
src/main/java/peko/commands/Find.javalines32-35:Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
Aspect: Recent Git Commit Message
possible problems in commit
7f122df:possible problems in commit
21a2703:Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
Aspect: Binary files in repo
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
cs2103@comp.nus.edu.sgif you want to follow up on this post.