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
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
No easy-to-detect issues 👍
Aspect: Method Length
Example from src/main/java/Bloom.java lines 42-92:
public void start(Stage stage) {
// Set 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();
// Format the window to look as expected
formatScrollPane(scrollPane);
formatDialogContainer(dialogContainer);
formatUserInput(userInput);
formatSendButton(sendButton);
formatStage(stage);
formatWindow(mainLayout);
// Add functionality to handle user input
sendButton.setOnMouseClicked((event) -> {
dialogContainer
.getChildren()
.add(getDialogLabel(userInput.getText()));
userInput.clear();
});
userInput.setOnAction((event) -> {
dialogContainer
.getChildren()
.add(getDialogLabel(userInput.getText()));
userInput.clear();
});
// Scroll down to the end every time dialogContainer's height changes
dialogContainer.heightProperty().addListener(
(observable) -> scrollPane.setVvalue(1.0));
// Add functionality to handle user input
sendButton.setOnMouseClicked((event) -> handleUserInput());
userInput.setOnAction((event) -> handleUserInput());
}
Example from src/main/java/bloom/app/Parser.java lines 79-116:
public LocalDateTime parseDate(String dateInput) {
String[] parse = dateInput.split(" ");
String date = parse[0];
String time = parse[1];
int[] separators = new int[2];
char separator;
if (dateInput.contains("-")) {
separator = '-';
} else { // assumes separator can be '-' or '/' only
separator = '/';
}
separators[0] = date.indexOf(separator);
separators[1] = date.indexOf(separator, separators[0] + 1);
String y = date.substring(separators[1] + 1);
String m = date.substring(separators[0] + 1, separators[1]);
String d = date.substring(0, separators[0]);
int year = Integer.parseInt(y);
int month = Integer.parseInt(m);
int day = Integer.parseInt(d);
String hr = time.substring(0, 2);
String min = time.substring(2, 4);
String sec = time.length() == 6
? time.substring(4, 6) : "00";
int hour = Integer.parseInt(hr);
int minute = Integer.parseInt(min);
int second = Integer.parseInt(sec);
assert year > 0;
assert month > 0;
assert day > 0;
assert hour > 0;
assert minute > 0;
assert second > 0;
return LocalDateTime.of(year, month, day, hour, minute, second);
}
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: Class size
No easy-to-detect issues 👍
Aspect: Header Comments
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message (Subject Only)
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 @nus-se-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, 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
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
No easy-to-detect issues 👍
Aspect: Method Length
Example from
src/main/java/Bloom.javalines42-92:Example from
src/main/java/bloom/app/Parser.javalines79-116: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: Class size
No easy-to-detect issues 👍
Aspect: Header Comments
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message (Subject Only)
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 @nus-se-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.