You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@leeyi45 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.
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)
publicstaticDialog<Optional<Task>> getAddTaskDialog() throwsIOException {
AddTaskWindowcontroller = newAddTaskWindow();
DialogPanepane = Utils.loadFxmlFile(AddTaskWindow.class.getResource("/view/AddTaskWindow.fxml"), controller);
Dialog<Optional<Task>> diag = newDialog<>();
diag.setDialogPane(pane);
diag.setResultConverter((buttonType) -> {
if (buttonType == ButtonType.OK) {
TasknewTask = controller.createTask();
returnOptional.of(newTask);
} else {
returnOptional.empty();
}
});
pane.getButtonTypes().addAll(
ButtonType.OK,
ButtonType.CANCEL
);
pane.lookupButton(ButtonType.OK).addEventFilter(ActionEvent.ACTION, event -> {
Stringerror = null;
StringtypeToAdd = controller.taskTypeComboBox.getValue();
if (typeToAdd == null || typeToAdd.isBlank()) {
error = "Select a type for the task!";
}
StringtaskDesc = controller.taskDescField.getText();
if (taskDesc == null || taskDesc.isBlank()) {
error = "A valid description for the task must be provided!";
}
if (typeToAdd.equals("Deadline")) {
if (controller.endDatePicker.getValue() == null) {
error = "Need a deadline!";
}
} elseif (typeToAdd.equals("Event")) {
if (controller.startDatePicker.getValue() == null) {
error = "Need a start time for event!";
} elseif (controller.endDatePicker.getValue() == null) {
error = "Need an end time for event!";
}
}
if (error != null) {
Alertalert = newAlert(AlertType.ERROR, error, newButtonType[] { ButtonType.OK });
alert.show();
event.consume();
}
});
returndiag;
}
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.
/** * Recombine an array of strings into a singular string, starting from the provided * start index to the end index exclusive. * @param args Array containing strings to join * @param from From index, inclusive * @param to To index, exclusive * @return Recombined string */
/** * Parse the strings for date and time information. Passing null for one of the arguments indicates * that only either date or time information was available. Passing both will create a LocalDateTime * with both time and date information. If there is a missing component, it will be filled with LocalDateTime.now(). * @param str0 Null or string to parse for either date or time * @param str1 Null or string to parse for either date or time * @return LocalDateTime containing either the parsed date and time or the parsed arguments * combined with the current time. */
/** * Throw {@link #ValidationException ValidationException} if the provided condition is false. * @param condition Condition to check * @param errMsg Error message to return to the user * @throws ValidationException */
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
ℹ️ 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.
The text was updated successfully, but these errors were encountered:
@leeyi45 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/duke/task/Task.java
lines19-19
: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
Example from
src/main/java/duke/commands/indexedCommand/DeleteCommand.java
lines1-1
:Example from
src/main/java/duke/commands/indexedCommand/IndexedCommand.java
lines1-1
:Example from
src/main/java/duke/commands/indexedCommand/MarkCommand.java
lines1-1
:Suggestion: Follow the package naming convention specified by the coding standard.
Aspect: Class Name Style
No easy-to-detect issues 👍
Aspect: Dead Code
Example from
src/main/java/duke/Utils.java
lines48-48
:// System.out.format("Couldn't match %s with %s\n", str, pattern);
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/duke/Utils.java
lines64-113
:Example from
src/main/java/duke/commands/taskCommand/EventCommand.java
lines16-62
:Example from
src/main/java/duke/ui/AddTaskWindow.java
lines40-90
: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/duke/Utils.java
lines23-30
:Example from
src/main/java/duke/Utils.java
lines55-63
:Example from
src/main/java/duke/commands/Command.java
lines28-33
: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 (Subject Only)
possible problems in commit
2a00f01
:Added a UI to Duke
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.The text was updated successfully, but these errors were encountered: