Shemplo/Neerc-chat-client

View on GitHub

Showing 15 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

    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)

                      Method controllOtherRoomChatMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                  @DestinationValue ("body")   String        body,
                                  @DestinationValue ("time")   LocalDateTime time,
                                  @DestinationValue ("author") String        author,
                                  @DestinationValue ("room")   String        room,
                                  @DestinationValue ("id")     String        id) {

                        Method controllWisperChatMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                    @DestinationValue ("body")      String        body,
                                    @DestinationValue ("time")      LocalDateTime time,
                                    @DestinationValue ("author")    String        author,
                                    @DestinationValue ("recipient") String        recipient,
                                    @DestinationValue ("id")        String        id) {

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

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

                          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 processPacket has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              @Override
                              public void processPacket (Packet packet) {
                                  if (packet instanceof Message) {
                                      final Message input = (Message) packet;
                                      

                          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