@basil-boh 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.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
Example from src/main/java/steve.tasks/Task.java lines 23-23:
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
No easy-to-detect issues 👍
Aspect: Method Length
Example from src/main/java/steve/ui/Main.java lines 50-140:
public void start(Stage stage) {
scrollPane = new ScrollPane();
dialogContainer = new VBox();
scrollPane.setContent(dialogContainer);
userInput = new TextField();
sendButton = new Button("Send");
// Handling user input
sendButton.setOnMouseClicked(event -> handleUserInput());
userInput.setOnAction(event -> handleUserInput());
AnchorPane mainLayout = new AnchorPane();
// Set background image
BackgroundImage background = new BackgroundImage(
backgroundImage,
BackgroundRepeat.NO_REPEAT,
BackgroundRepeat.NO_REPEAT,
BackgroundPosition.CENTER,
new BackgroundSize(
BackgroundSize.AUTO,
BackgroundSize.AUTO,
false,
false,
true,
true
)
);
mainLayout.setBackground(new Background(background));
mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
scene = new Scene(mainLayout, 400, 600);
// Display greeting message at the start
String greeting = Messages.greetingToString();
dialogContainer.getChildren().add(DialogBox.getSteveDialog(greeting, steveImage));
// Allow resizing
stage.setTitle("Steve");
stage.setResizable(true);
stage.setMinHeight(600.0);
stage.setMinWidth(400.0);
// Set component properties
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
scrollPane.setVvalue(1.0);
scrollPane.setFitToWidth(true);
dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);
// Make scrollPane background transparent to show main background
scrollPane.setStyle("-fx-background: transparent; -fx-background-color: transparent;");
dialogContainer.setStyle("-fx-background-color: transparent;");
// Bind UI elements to window size
scrollPane.prefHeightProperty().bind(mainLayout.heightProperty().subtract(50));
scrollPane.prefWidthProperty().bind(mainLayout.widthProperty());
dialogContainer.prefWidthProperty().bind(scrollPane.widthProperty().subtract(20));
userInput.prefWidthProperty().bind(mainLayout.widthProperty()
.subtract(sendButton.widthProperty()).subtract(10));
sendButton.prefWidthProperty().bind(mainLayout.widthProperty().multiply(0.15));
// Set layout constraints
AnchorPane.setTopAnchor(scrollPane, 1.0);
AnchorPane.setLeftAnchor(scrollPane, 1.0);
AnchorPane.setRightAnchor(scrollPane, 1.0);
AnchorPane.setBottomAnchor(scrollPane, 50.0);
AnchorPane.setLeftAnchor(userInput, 1.0);
AnchorPane.setBottomAnchor(userInput, 1.0);
AnchorPane.setRightAnchor(sendButton, 1.0);
AnchorPane.setBottomAnchor(sendButton, 1.0);
// Auto-scroll when new messages appear
dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
// Styling
userInput.setStyle("-fx-font-size: 14px;");
sendButton.setStyle("-fx-font-size: 14px;");
dialogContainer.setPadding(new Insets(10, 10, 10, 10));
dialogContainer.setSpacing(10);
stage.setScene(scene);
stage.show();
}
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/steve/ui/Steve.java lines 34-39:
/**
* The main method that runs the application.
* Loads tasks from the file, initializes the TaskManager and UserInterface, and starts the application.
*
* @param args command-line arguments (not used)
*/
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 Messages
possible problems in commit f76929c:
Amended TaskManager.java addTask comment
- Not in imperative mood (?)
Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
Aspect: Binary files in repo
No easy-to-detect issues 👍
❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality 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.
@basil-boh 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.
Aspect: Tab Usage
No easy-to-detect issues 👍
Aspect: Naming boolean variables/methods
Example from
src/main/java/steve.tasks/Task.javalines23-23: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
No easy-to-detect issues 👍
Aspect: Method Length
Example from
src/main/java/steve/ui/Main.javalines50-140: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/steve/ui/Steve.javalines34-39: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 Messages
possible problems in commit
f76929c:Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
Aspect: Binary files in repo
No easy-to-detect issues 👍
❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality 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.