Shemplo/Neerc-chat-client

View on GitHub

Showing 35 of 35 total issues

File EmojiList.java has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package ru.shemplo.chat.neerc.gfx.panes;

import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
Severity: Minor
Found in src/main/java/ru/shemplo/chat/neerc/gfx/panes/EmojiList.java - About 7 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            SceneComponent.USERS_V.<VBox> safe (holder.getScene ()).ifPresent (line -> {
                Platform.runLater (line.getChildren ()::clear);
                
                final UsersService usersService = holder.getManager ().getUsersService ();
                List <Button> buttons = usersService.getUsers ().stream ().sorted (UE_COMPARATOR)
    src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneListener.java on lines 85..110

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 252.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            SceneComponent.USERS_H.<HBox> safe (holder.getScene ())
                          .ifPresent (line -> {
                Platform.runLater (line.getChildren ()::clear);
                
                final UsersService usersService = holder.getManager ().getUsersService ();
    src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneListener.java on lines 111..129

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 252.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File MainSceneHolder.java has 309 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package ru.shemplo.chat.neerc.gfx.scenes;
    
    import static java.time.ZoneOffset.*;
    import static ru.shemplo.chat.neerc.enities.MessageEntity.MessageAccess.*;
    
    Severity: Minor
    Found in src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java - About 3 hrs to fix

      Method _makeDefaultMessage has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void _makeDefaultMessage (Pane container, MessageEntity message) {
              String tmpBody = message.getBody (), ident = "(\\w|_|-)+";
              final Pattern emojiPattern 
                  = Pattern.compile (String.format (":%s:", ident));
              final Insets insets = new Insets (0, 8, 0, 0);
      Severity: Major
      Found in src/main/java/ru/shemplo/chat/neerc/gfx/panes/MessageInterpreter.java - About 2 hrs to fix

        Method changeStatusByClicking has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private void changeStatusByClicking () {
                RequestIQ requestIQ = null;
                if (type.equals (CONFIRM)) {
                    requestIQ = new TaskStatusIQ (taskID, 
                        taskStatus.equals (SUCCESS) ? NONE: SUCCESS, "");
        Severity: Minor
        Found in src/main/java/ru/shemplo/chat/neerc/gfx/panes/TaskTile.java - About 2 hrs 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

        Method route has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void route (Message message) {
                if (message.getBody () == null) { return; }
                
                final String from = message.getFrom ().asUnescapedString (),

          Method onUsersUpdated has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void onUsersUpdated () {
                  SceneComponent.USERS_H.<HBox> safe (holder.getScene ())
                                .ifPresent (line -> {
                      Platform.runLater (line.getChildren ()::clear);

            Method mergeTasks has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public synchronized void mergeTasks (Collection <TaskEntity> tasks) {        
                    boolean numberOfTasksChanged = this.tasks.size () != tasks.size ();
                    List <String> keys = new ArrayList <> (this.tasks.keySet ());
                    Set <String> keep = new HashSet <> (tasks.stream ()
                                      . map (TaskEntity::getId)
            Severity: Minor
            Found in src/main/java/ru/shemplo/chat/neerc/network/TasksService.java - About 1 hr to fix

              Method makeDefaultButtons has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private final void makeDefaultButtons () {
                      Button reconnect = SceneComponent.RECONNECT_BUTTON.get (scene);
                      reconnect.setOnAction (__ -> {
                          new Thread (manager.getSharedContext ().getClientAdapter ()::performReconnection)
                            . start (); // Not to block GUI thread
              Severity: Minor
              Found in src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java - About 1 hr to fix

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

                    @Override
                    protected void updateItem (MessageEntity item, boolean empty) {
                        super.updateItem (item, empty || item == null);
                        if (empty || item == null) { 
                            setGraphic (null);
                Severity: Minor
                Found in src/main/java/ru/shemplo/chat/neerc/gfx/panes/MessageCell.java - About 1 hr to fix

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

                      private final void makeDefaultTabs () {
                          DetachableTab publicChatTab = new DetachableTab ("public");
                          openedTabs.put (publicChatTab.getText (), publicChatTab);
                          final Conversation publicConversation 
                              = new Conversation (this, publicChatTab.getText ());
                  Severity: Minor
                  Found in src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java - About 1 hr to fix

                    Method onUserChangedPresence has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public void onUserChangedPresence (String user, OnlineStatus status) {
                            Image image = Stream.of (status)
                                    . map (OnlineStatus::name)
                                    . map (String::toLowerCase)

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              SceneComponent.USERS_H.<HBox> safe (holder.getScene ())
                                            .ifPresent (line -> {
                                  Platform.runLater (() -> {
                                      line.getChildren ().stream ()
                                          .map       (o -> (Button) o)
                      src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneListener.java on lines 58..67

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 74.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              Optional <Method> callMethod = ROUTE_METHODS.get (routeAnnotation).stream ()
                                                           . map (m -> Pair.mp (m, m.getAnnotation (routeAnnotation)))
                                                           . filter (p -> namespace.matches (p.S.namespace ()))
                                                           . filter (p -> author.matches (p.S.author ()))
                                                           . filter (p -> room.matches   (p.S.room ()))
                      src/main/java/ru/shemplo/chat/neerc/network/control/DefaultPacketRouter.java on lines 165..169

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 74.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              Optional <Method> callMethod = ROUTE_METHODS.get (routeAnnotation).stream ()
                                                           . map       (m -> Pair.mp (m, m.getAnnotation (routeAnnotation)))
                                                           . filter    (p -> type.equals (p.S.meessageType ()))
                                                           . filter    (p -> name.matches   (p.S.name ()))
                                                           . filter    (p -> namespace.matches (p.S.namespace ()))
                      src/main/java/ru/shemplo/chat/neerc/network/control/DefaultPacketRouter.java on lines 132..136

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 74.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              SceneComponent.USERS_V.<VBox> safe (holder.getScene ())
                                            .ifPresent (line -> {
                                  Platform.runLater (() -> {
                                    line.getChildren ().stream ()
                                        .map       (o -> (Button) o)
                      src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneListener.java on lines 48..57

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 74.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          @Override
                          public AbsCustomIQ parse (XmlPullParser parser, int initialDepth) throws Exception {
                              AbsCustomIQ iq = null;
                              switch (parser.getNamespace ().split ("#") [1]) {
                                  case "users": iq = new UsersListIQ (); break;
                      src/main/java/ru/shemplo/chat/neerc/network/exten/CustomExtensionProvider.java on lines 70..83

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 73.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          @Override
                          public AbsCustomExtensionElement parse (XmlPullParser parser, int initialDepth) throws Exception {
                              AbsCustomExtensionElement elementExtension = null;
                              
                              switch (parser.getNamespace ().split ("#") [1]) {
                      src/main/java/ru/shemplo/chat/neerc/network/iq/CustomIQProvider.java on lines 60..72

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 73.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                  usersScrollVertical.setOnScroll (se -> {
                                      double hValue = usersScrollVertical.getVvalue (), delta = se.getDeltaY () * 1.5;
                                      VBox users = SceneComponent.USERS_V.get (scene);
                                      usersScrollVertical.setVvalue (hValue - delta / users.getWidth ());
                                  });            
                      src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java on lines 82..86

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 62.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language