mizo0203/lily-white-line-notify

View on GitHub

Showing 9 of 10 total issues

ReminderUseCase has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ReminderUseCase implements AutoCloseable {

  private static final String ACTION_DATA_REQUEST_REMINDER_CANCELLATION =
      "ACTION_DATA_REQUEST_REMINDER_CANCELLATION";
  private static final String ACTION_DATA_REQUEST_ACCESS_TOKEN_COMPLETION =
Severity: Minor
Found in src/main/java/com/mizo0203/lilywhite/domain/ReminderUseCase.java - About 6 hrs to fix

    File ReminderUseCase.java has 366 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.mizo0203.lilywhite.domain;
    
    import com.linecorp.bot.model.action.Action;
    import com.linecorp.bot.model.action.DatetimePickerAction;
    import com.linecorp.bot.model.action.PostbackAction;
    Severity: Minor
    Found in src/main/java/com/mizo0203/lilywhite/domain/ReminderUseCase.java - About 4 hrs to fix

      Method notify has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public void notify(
            @Nonnull String access_token,
            @Nonnull String message,
            @Nullable String imageThumbnail,
            @Nullable String imageFullsize,
      Severity: Minor
      Found in src/main/java/com/mizo0203/lilywhite/repo/LineRepository.java - About 1 hr to fix

        Method tokenOauth has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public void tokenOauth(
              String code,
              String client_id,
              String client_secret,
              @Nonnull Callback<AccessToken> callback) {
        Severity: Minor
        Found in src/main/java/com/mizo0203/lilywhite/repo/LineRepository.java - About 1 hr to fix

          Method post has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public static void post(
                URL url, Map<String, String> reqProp, @Nonnull String body, Callback callback) {
              LOG.info("post url:     " + url);
              LOG.info("post reqProp: " + reqProp);
              LOG.info("post body:    " + body);
          Severity: Minor
          Found in src/main/java/com/mizo0203/lilywhite/util/HttpUtil.java - About 1 hr to fix

            Method status has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public void status(@Nonnull String access_token, @Nonnull Callback<ResponseStatusData> callback) {
                Map<String, String> reqProp = new HashMap<>();
                reqProp.put("Authorization", "Bearer " + access_token);
            
                try {
            Severity: Minor
            Found in src/main/java/com/mizo0203/lilywhite/repo/LineRepository.java - About 1 hr to fix

              Method revoke has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public void revoke(@Nonnull String access_token, @Nonnull Callback<ResponseRevokeData> callback) {
                  Map<String, String> reqProp = new HashMap<>();
                  reqProp.put("Content-Type", "application/x-www-form-urlencoded");
                  reqProp.put("Authorization", "Bearer " + access_token);
              
              
              Severity: Minor
              Found in src/main/java/com/mizo0203/lilywhite/repo/LineRepository.java - About 1 hr to fix

                Method notify has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      @Nonnull String access_token,
                      @Nonnull String message,
                      @Nullable String imageThumbnail,
                      @Nullable String imageFullsize,
                      @Nullable String imageFile,
                Severity: Major
                Found in src/main/java/com/mizo0203/lilywhite/repo/LineRepository.java - About 1 hr to fix

                  Method onLinePostBack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private void onLinePostBack(PostbackEvent event) {
                      if (State.NO_NICKNAME.equals(mState)) {
                        return;
                      }
                      try (ReminderUseCase reminderUseCase = new ReminderUseCase(mRepository, mConfig)) {
                  Severity: Minor
                  Found in src/main/java/com/mizo0203/lilywhite/domain/EventUseCase.java - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language