Shemplo/Neerc-chat-client

View on GitHub
src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java

Summary

Maintainability
C
1 day
Test Coverage

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

        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

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

                    usersScrollHorizontal.setOnScroll (se -> {
                        double hValue = usersScrollHorizontal.getHvalue (), delta = se.getDeltaY () * 1.5;
                        HBox users = SceneComponent.USERS_H.get (scene);
                        usersScrollHorizontal.setHvalue (hValue - delta / users.getWidth ());
                    });
        src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java on lines 96..100

        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

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

                Optional.ofNullable (prev).ifPresent (tab -> {
                    Node content = tab.getContent ();
                    
                    if (!(content instanceof AbsTabContent)) { return; }
                    AbsTabContent tabContent = (AbsTabContent) content;
        src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java on lines 67..73

        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 56.

        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.ofNullable (next).ifPresent (tab -> {
                    Node content = tab.getContent ();
                    
                    if (!(content instanceof AbsTabContent)) { return; }
                    AbsTabContent tabContent = (AbsTabContent) content;
        src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java on lines 59..65

        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 56.

        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

                Optional.ofNullable (SceneComponent.CLOCK_TOTAL.<Label> get (scene))
                        .ifPresent (label -> {
                    LocalDateTime time = LocalDateTime.ofEpochSecond (info.S, 0, UTC);
                    label.setText (time.format (DateTimeFormatter.ISO_LOCAL_TIME));
                });
        src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java on lines 245..249

        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 52.

        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

                Optional.ofNullable (SceneComponent.CLOCK_TIME.<Label> get (scene))
                        .ifPresent (label -> {
                    LocalDateTime time = LocalDateTime.ofEpochSecond (info.F, 0, UTC);
                    label.setText (time.format (DateTimeFormatter.ISO_LOCAL_TIME));
                });
        src/main/java/ru/shemplo/chat/neerc/gfx/scenes/MainSceneHolder.java on lines 250..254

        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 52.

        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

        There are no issues that match your filters.

        Category
        Status