Skip to content

Commit

Permalink
[lihui] #N/A refactor: fix code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
lhui committed Apr 5, 2024
1 parent 3f08f6a commit 71d983d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public Card createCard(Card card) {
public List<Label> getLabels() {
return trelloApi.getBoardLabels(trelloConfiguration.getTrelloBoardId()).stream()
.filter(label -> StringUtils.isNotBlank(label.getName()))
.collect(Collectors.toList());
.toList();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package net.lihui.app.plugin.thoughtworkscodereviewtools.constant;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access= AccessLevel.PRIVATE)
public class TrelloRequestErrorConstant {
public static final String BOARD_ID_INVALID_ERROR_MESSAGE = "invalid id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.lihui.app.plugin.thoughtworkscodereviewtools.ui.FeedbackContext;

import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static net.lihui.app.plugin.thoughtworkscodereviewtools.constant.TrelloRequestErrorConstant.AUTHORIZED_FAILED_FILL_SETTING_NOTIFICATION;
import static net.lihui.app.plugin.thoughtworkscodereviewtools.constant.TrelloRequestErrorConstant.BOARD_ID_INVALID_ERROR_MESSAGE;
import static net.lihui.app.plugin.thoughtworkscodereviewtools.constant.TrelloRequestErrorConstant.INVALID_BOARD_ID_NOTIFICATION;
Expand Down Expand Up @@ -57,7 +58,7 @@ private void doAction(AnActionEvent actionEvent) {

private void initCodeReviewBoardService() {
TrelloConfiguration trelloConfiguration = TrelloState.getInstance().getState();
if (trelloConfiguration.isAnyBlank()) {
if (nonNull(trelloConfiguration) && trelloConfiguration.isAnyBlank()) {
throw new BaseException(SET_UP_NOTIFICATION);
}
codeReviewBoardService = new CodeReviewBoardService(trelloConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import javax.swing.*;

import java.util.Objects;

import static net.lihui.app.plugin.thoughtworkscodereviewtools.constant.TrelloRequestErrorConstant.AUTHORIZED_FAILED_FILL_SETTING_NOTIFICATION;
import static net.lihui.app.plugin.thoughtworkscodereviewtools.constant.TrelloRequestErrorConstant.BOARD_ID_INVALID_ERROR_MESSAGE;
import static net.lihui.app.plugin.thoughtworkscodereviewtools.constant.TrelloRequestErrorConstant.INVALID_BOARD_ID_NOTIFICATION;
Expand Down Expand Up @@ -51,7 +53,7 @@ public JComponent createComponent() {
public boolean isModified() {
TrelloConfiguration trelloConfiguration = TrelloState.getInstance().getState();

return !trelloConfiguration.equals(twCodeReviewSettingsComponent.getCurrentTrelloConfiguration());
return !Objects.equals(trelloConfiguration, twCodeReviewSettingsComponent.getCurrentTrelloConfiguration());
}

@Override
Expand Down

0 comments on commit 71d983d

Please sign in to comment.