java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java

Summary

Maintainability
F
2 wks
Test Coverage
C
73%

Method addBeanSettings has a Cognitive Complexity of 479 (exceeds 20 allowed). Consider refactoring.
Open

    public void addBeanSettings(Path p, LayoutConnectivity lc, LayoutBlock layoutBlock) {
        p.clearSettings();
        LayoutTrack curConnection = null;
        LayoutTrack prevConnection = null;
        HitPointType typeCurConnection = HitPointType.NONE;
Severity: Minor
Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java - About 1 wk 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 addBeanSettings has 542 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void addBeanSettings(Path p, LayoutConnectivity lc, LayoutBlock layoutBlock) {
        p.clearSettings();
        LayoutTrack curConnection = null;
        LayoutTrack prevConnection = null;
        HitPointType typeCurConnection = HitPointType.NONE;
Severity: Major
Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java - About 2 days to fix

    File LayoutEditorAuxTools.java has 668 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    package jmri.jmrit.display.layoutEditor;
    
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;
    Severity: Major
    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java - About 1 day to fix

      Method checkConnectivity has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void checkConnectivity(LayoutConnectivity c, boolean[] found) {
              // initialize input LayoutConnectivity components
              LayoutBlock blk1 = c.getBlock1();
              LayoutBlock blk2 = c.getBlock2();
      
      
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java - About 1 hr to fix

        Method updateBlockConnectivity has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void updateBlockConnectivity() {
                int sz = cList.size();
                boolean[] found = new boolean[sz];
                Arrays.fill(found, false);
        
        
        Severity: Minor
        Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                                  if ((turnoutType == LayoutTurnout.TurnoutType.DOUBLE_XOVER)
                                          || ((turnoutType == LayoutTurnout.TurnoutType.RH_XOVER) && ((typeCurConnection == HitPointType.TURNOUT_A) || (typeCurConnection == HitPointType.TURNOUT_C)))
                                          || ((turnoutType == LayoutTurnout.TurnoutType.LH_XOVER) && ((typeCurConnection == HitPointType.TURNOUT_B) || (typeCurConnection == HitPointType.TURNOUT_D)))) {
                                      // entering turnout at a throat, cannot follow path any further
                                      curConnection = null;
          Severity: Major
          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java - About 40 mins to fix

            Method checkConnectivity has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
            Open

                private void checkConnectivity(LayoutConnectivity c, boolean[] found) {
                    // initialize input LayoutConnectivity components
                    LayoutBlock blk1 = c.getBlock1();
                    LayoutBlock blk2 = c.getBlock2();
            
            
            Severity: Minor
            Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.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

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

                            } else if (lt.getTurnoutType() == LayoutTurnout.TurnoutType.LH_XOVER) {
                                // have a left-handed crossover turnout
                                if ((typeCurConnection == HitPointType.TURNOUT_B)
                                        || (typeCurConnection == HitPointType.TURNOUT_D)) {
                                    // entry is at turnout throat, cannot follow possible path any further
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 651..698

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

            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

                            } else if (lt.getTurnoutType() == LayoutTurnout.TurnoutType.RH_XOVER) {
                                // have a right-handed crossover turnout
                                if ((typeCurConnection == HitPointType.TURNOUT_A)
                                        || (typeCurConnection == HitPointType.TURNOUT_C)) {
                                    // entry is at turnout throat, cannot follow possible path any further
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 698..745

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

            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

                        if ((lt != null) && (lt.getTurnout() != null)) {
                            int type = lc.getXoverBoundaryType();
                            // bs is known to be null at this point
                            if (lt.getTurnout() != null) {
                                if (type == LayoutConnectivity.XOVER_BOUNDARY_AB) {
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 367..393

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

            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

                            if ((lt != null) && (lt.getTurnout() != null)) {
                                int type = lc.getXoverBoundaryType();
                                // bs is known to be null at this point
                                if (lt.getTurnout() != null) {
                                    if (type == LayoutConnectivity.XOVER_BOUNDARY_AB) {
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 398..424

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

            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

                                } else if (typeCurConnection == HitPointType.TURNOUT_C) {
                                    // diverging track of turnout
                                    if (((LayoutTurnout) curConnection).getTurnout() != null) {
                                        if (((LayoutTurnout) curConnection).getContinuingSense() == Turnout.CLOSED) {
                                            bs = new BeanSetting(((LayoutTurnout) curConnection).getTurnout(), ((LayoutTurnout) curConnection).getTurnoutName(), Turnout.THROWN);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 468..484

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

            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

                                } else if (typeCurConnection == HitPointType.TURNOUT_B) {
                                    // continuing track of turnout
                                    if (((LayoutTurnout) curConnection).getTurnout() != null) {
                                        if (((LayoutTurnout) curConnection).getContinuingSense() == Turnout.CLOSED) {
                                            bs = new BeanSetting(((LayoutTurnout) curConnection).getTurnout(), ((LayoutTurnout) curConnection).getTurnoutName(), Turnout.CLOSED);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 484..500

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

            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

                                } else if (typeCurConnection == HitPointType.SLIP_B) {
                                    if (ls.getTurnout() != null) {
                                        bs = new BeanSetting(ls.getTurnout(), ls.getTurnoutName(), ls.getTurnoutState(LayoutTurnout.STATE_BD));
                                        p.addSetting(bs);
                                    } else {
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 795..811

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

            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

                                if (typeCurConnection == HitPointType.SLIP_C) {
                                    if (ls.getTurnout() != null) {
                                        bs = new BeanSetting(ls.getTurnout(), ls.getTurnoutName(), ls.getTurnoutState(LayoutTurnout.STATE_AC));
                                        p.addSetting(bs);
                                    } else {
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 811..828

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

            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

                                    } else if (typeCurConnection == HitPointType.TURNOUT_C) {
                                        // diverging track of turnout
                                        if (lt.getTurnout() != null) {
                                            if (lt.getContinuingSense() == Turnout.CLOSED) {
                                                bs = new BeanSetting(lt.getTurnout(), lt.getTurnoutName(), Turnout.THROWN);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 608..627

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

            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

                                    } else if (typeCurConnection == HitPointType.TURNOUT_B) {
                                        // continuing track of turnout, add a bean setting
                                        if (lt.getTurnout() != null) {
                                            if (lt.getContinuingSense() == Turnout.CLOSED) {
                                                bs = new BeanSetting(lt.getTurnout(), lt.getTurnoutName(), Turnout.CLOSED);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 627..646

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

            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

                                    } else if (lc.getConnectedType() == HitPointType.SLIP_B) {
                                        Turnout lszto = lsz.getTurnout();
                                        if (lszto != null) {
                                            bs = new BeanSetting(lszto, lsz.getTurnoutName(), lsz.getTurnoutState(LayoutTurnout.STATE_BD));
                                            p.addSetting(bs);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 312..327

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

            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

                                    if (lc.getConnectedType() == HitPointType.SLIP_C) {
                                        Turnout lszto = lsz.getTurnout();
                                        if (lszto != null) {
                                            bs = new BeanSetting(lszto, lsz.getTurnoutName(), lsz.getTurnoutState(LayoutTurnout.STATE_AC));
                                            p.addSetting(bs);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 327..343

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

            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 4 locations. Consider refactoring.
            Open

                        } else if (typeCurConnection == HitPointType.LEVEL_XING_D) {
                            // have a level crossing connected at D
                            if (((LevelXing) curConnection).getLayoutBlockBD() != layoutBlock) {
                                // moved outside of this block
                                curConnection = null;
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 768..779
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 757..768
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 746..757

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

            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 4 locations. Consider refactoring.
            Open

                        } else if (typeCurConnection == HitPointType.LEVEL_XING_C) {
                            // have a level crossing connected at C
                            if (((LevelXing) curConnection).getLayoutBlockAC() != layoutBlock) {
                                // moved outside of this block
                                curConnection = null;
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 779..790
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 757..768
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 746..757

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

            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 4 locations. Consider refactoring.
            Open

                        } else if (typeCurConnection == HitPointType.LEVEL_XING_B) {
                            // have a level crossing connected at B
                            if (((LevelXing) curConnection).getLayoutBlockBD() != layoutBlock) {
                                // moved outside of this block
                                curConnection = null;
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 779..790
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 768..779
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 746..757

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

            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 4 locations. Consider refactoring.
            Open

                        } else if (typeCurConnection == HitPointType.LEVEL_XING_A) {
                            // have a level crossing connected at A
                            if (((LevelXing) curConnection).getLayoutBlockAC() != layoutBlock) {
                                // moved outside of this block
                                curConnection = null;
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 779..790
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 768..779
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 757..768

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

            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

                                if (((ltz.getTurnoutType() == LayoutTurnout.TurnoutType.RH_XOVER)
                                        && ((lc.getConnectedType() == HitPointType.TURNOUT_B)
                                        || (lc.getConnectedType() == HitPointType.TURNOUT_D)))
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 295..297

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

            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

                                        || ((ltz.getTurnoutType() == LayoutTurnout.TurnoutType.LH_XOVER)
                                        && ((lc.getConnectedType() == HitPointType.TURNOUT_A)
                                        || (lc.getConnectedType() == HitPointType.TURNOUT_C)))) {
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 292..294

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

            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

                            if ((blk1 == lc.getBlock1()) && (blk2 == lc.getBlock2()) && (track == lc.getTrackSegment())
                                    && (connected == lc.getConnectedObject()) && (type == lc.getConnectedType())
            java/src/jmri/jmrix/loconet/duplexgroup/swing/LnIPLImplementation.java on lines 968..971

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

            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

                                            || ((turnoutType == LayoutTurnout.TurnoutType.LH_XOVER) && ((typeCurConnection == HitPointType.TURNOUT_B) || (typeCurConnection == HitPointType.TURNOUT_D)))) {
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 438..438

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

            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

                                            || ((turnoutType == LayoutTurnout.TurnoutType.RH_XOVER) && ((typeCurConnection == HitPointType.TURNOUT_A) || (typeCurConnection == HitPointType.TURNOUT_C)))
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 439..439

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

            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 4 locations. Consider refactoring.
            Open

                    for (LayoutTurnout lt : models.getLayoutTurnouts()) {
                        lcs = lt.getLayoutConnectivity();
                        for (LayoutConnectivity lc : lcs) {
                            // add to list, if not already present
                            checkConnectivity(lc, found);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 123..129
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 132..138
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 150..156

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

            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 4 locations. Consider refactoring.
            Open

                    for (LayoutSlip ls : models.getLayoutSlips()) {
                        lcs = ls.getLayoutConnectivity();
                        for (LayoutConnectivity lc : lcs) {
                            // add to list, if not already present
                            checkConnectivity(lc, found);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 123..129
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 132..138
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 141..147

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

            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 4 locations. Consider refactoring.
            Open

                    for (PositionablePoint p : models.getPositionablePoints()) {
                        lcs = p.getLayoutConnectivity();
                        for (LayoutConnectivity lc : lcs) {
                            // add to list, if not already present
                            checkConnectivity(lc, found);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 132..138
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 141..147
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 150..156

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

            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 4 locations. Consider refactoring.
            Open

                    for (TrackSegment ts : models.getTrackSegments()) {
                        lcs = ts.getLayoutConnectivity();
                        for (LayoutConnectivity lc : lcs) {
                            // add to list, if not already present
                            checkConnectivity(lc, found);
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 123..129
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 141..147
            java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java on lines 150..156

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

            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