Skip to content

Commit

Permalink
Tidy code
Browse files Browse the repository at this point in the history
Let's,
* remove unnecessary comments
* store printed String in a static variable
* remove unnecessary methods and method calls
  • Loading branch information
KrashKart committed Oct 20, 2024
1 parent f1973a5 commit 26c133f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
try {
campusConnectOptional = storage.readCampusConnect();
if (!campusConnectOptional.isPresent()) {
// logger.info("Creating a new data file " + storage.getCampusConnectFilePath()
// + " populated with a sample CampusConnect.");

logger.info("Creating a new data file at: " + storage.getCampusConnectFilePath());

Check warning on line 83 in src/main/java/seedu/address/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/MainApp.java#L83

Added line #L83 was not covered by tests
}
// initialData = campusConnectOptional.orElseGet(SampleDataUtil::getSampleCampusConnect);
initialData = campusConnectOptional.orElseGet(EmptyDataUtil::getSampleCampusConnect);

Check warning on line 85 in src/main/java/seedu/address/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/MainApp.java#L85

Added line #L85 was not covered by tests
} catch (DataLoadingException e) {
logger.warning("Data file at " + storage.getCampusConnectFilePath() + " could not be loaded."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public CommandResult execute(Model model) {

// if the result find list is empty
if (model.getFilteredPersonList().isEmpty()) {
return new CommandResult(String.format(MESSAGE_NO_PERSONS_FOUND));
return new CommandResult(MESSAGE_NO_PERSONS_FOUND);
}

return new CommandResult(
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class MainWindow extends UiPart<Stage> {

private static final String FXML = "MainWindow.fxml";

private static final String LIST_EMPTY_MESSAGE = "The contact list is empty! :(";

private final Logger logger = LogsCenter.getLogger(getClass());

private Stage primaryStage;
Expand Down Expand Up @@ -116,7 +118,7 @@ void fillInnerParts() {
resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
if (logic.getFilteredPersonList().isEmpty()) {
resultDisplay.setFeedbackToUser("The contact list is empty! :(");
resultDisplay.setFeedbackToUser(LIST_EMPTY_MESSAGE);

Check warning on line 121 in src/main/java/seedu/address/ui/MainWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/MainWindow.java#L121

Added line #L121 was not covered by tests
}

StatusBarFooter statusBarFooter = new StatusBarFooter(logic.getCampusConnectFilePath());
Expand Down

0 comments on commit 26c133f

Please sign in to comment.