java/src/jmri/jmrit/entryexit/DestinationPoints.java

Summary

Maintainability
F
3 wks
Test Coverage
F
34%

Method setRoute has a Cognitive Complexity of 204 (exceeds 20 allowed). Consider refactoring.
Open

    void setRoute(boolean state) {
        if (log.isDebugEnabled()) {
            log.debug("Set route {}", src.getPoint().getDisplayName());  // NOI18N
        }
        if (disposed) {
Severity: Minor
Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 3 days 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 cancelClearInterlock has a Cognitive Complexity of 158 (exceeds 20 allowed). Consider refactoring.
Open

    void cancelClearInterlock(int cancelClear) {
        if ((cancelClear == EntryExitPairs.EXITROUTE) || (cancelClear == EntryExitPairs.STACKROUTE)) {
            src.pd.setNXButtonState(EntryExitPairs.NXBUTTONINACTIVE);
            point.setNXButtonState(EntryExitPairs.NXBUTTONINACTIVE);
            src.getPoint().getPanel().getGlassPane().setVisible(false);
Severity: Minor
Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 2 days 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

File DestinationPoints.java has 1169 lines of code (exceeds 300 allowed). Consider refactoring.
Open

package jmri.jmrit.entryexit;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.awt.BorderLayout;
import java.awt.Color;
Severity: Major
Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 2 days to fix

    Method activeBean has a Cognitive Complexity of 139 (exceeds 20 allowed). Consider refactoring.
    Open

        synchronized void activeBean(boolean reverseDirection, boolean showMessage) {
            // Clear any previous memory message
            MemoryManager mgr = InstanceManager.getDefault(MemoryManager.class);
            Memory nxMem = mgr.getMemory(manager.getMemoryOption());
            if (nxMem != null) {
    Severity: Minor
    Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 2 days 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 run has a Cognitive Complexity of 121 (exceeds 20 allowed). Consider refactoring.
    Open

                @Override
                public void run() {
                    src.getPoint().getPanel().getGlassPane().setVisible(true);
    
                    try {
    Severity: Minor
    Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 2 days 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 setRoute has 295 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        void setRoute(boolean state) {
            if (log.isDebugEnabled()) {
                log.debug("Set route {}", src.getPoint().getDisplayName());  // NOI18N
            }
            if (disposed) {
    Severity: Major
    Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 1 day to fix

      Method activeBean has 204 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          synchronized void activeBean(boolean reverseDirection, boolean showMessage) {
              // Clear any previous memory message
              MemoryManager mgr = InstanceManager.getDefault(MemoryManager.class);
              Memory nxMem = mgr.getMemory(manager.getMemoryOption());
              if (nxMem != null) {
      Severity: Major
      Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 1 day to fix

        Method cancelClearInterlock has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            void cancelClearInterlock(int cancelClear) {
                if ((cancelClear == EntryExitPairs.EXITROUTE) || (cancelClear == EntryExitPairs.STACKROUTE)) {
                    src.pd.setNXButtonState(EntryExitPairs.NXBUTTONINACTIVE);
                    point.setNXButtonState(EntryExitPairs.NXBUTTONINACTIVE);
                    src.getPoint().getPanel().getGlassPane().setVisible(false);
        Severity: Major
        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 7 hrs to fix

          DestinationPoints has 47 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class DestinationPoints extends jmri.implementation.AbstractNamedBean {
          
              @Override
              public String getBeanType() {
                  return Bundle.getMessage("BeanNameDestination");  // NOI18N
          Severity: Minor
          Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 6 hrs to fix

            Method removeBlockFromRoute has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
            Open

                synchronized void removeBlockFromRoute(LayoutBlock lBlock) {
            
                    if (routeDetails != null) {
                        if (routeDetails.indexOf(lBlock) == -1) {
                            if (src.getStart() == lBlock) {
            Severity: Minor
            Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 3 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 cancelClearOptionBox has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                void cancelClearOptionBox() {
                    if (cancelClearFrame == null) {
                        JButton jButton_Clear = new JButton(Bundle.getMessage("ClearDown"));  // NOI18N
                        JButton jButton_Cancel = new JButton(Bundle.getMessage("ButtonCancel"));  // NOI18N
            
            
            Severity: Major
            Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 3 hrs to fix

              Method removeBlockFromRoute has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  synchronized void removeBlockFromRoute(LayoutBlock lBlock) {
              
                      if (routeDetails != null) {
                          if (routeDetails.indexOf(lBlock) == -1) {
                              if (src.getStart() == lBlock) {
              Severity: Major
              Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 2 hrs to fix

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

                    void handleNoCurrentRoute(boolean reverse, String message) {
                        int opt = manager.getOverlapOption();
                
                        if (opt == EntryExitPairs.PROMPTUSER) {
                            Object[] options = {
                Severity: Minor
                Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 1 hr to fix

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

                      private void releaseMast(SignalMast mast, Hashtable<Turnout, Integer> turnoutSettings) {
                          Hashtable<Turnout, Integer> turnoutList = new Hashtable<>(turnoutSettings);
                          Runnable r = new Runnable() {
                              @Override
                              public void run() {
                  Severity: Minor
                  Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                                if (t==null) {
                                                                    log.warn("Found unexpected Turnout reference at {}: {}",i,ls);
                                                                    continue; // not sure what else do to here
                                                                }
                    Severity: Major
                    Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 45 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return;
                      Severity: Major
                      Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java - About 30 mins to fix

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

                                                if (routeDetails.get(routeDetails.size() - 2).getOccupancySensor() != null) {
                                                    routeDetails.get(routeDetails.size() - 2).getOccupancySensor().setState(Sensor.INACTIVE);
                                                } else {
                                                    routeDetails.get(routeDetails.size() - 2).getBlock().goingInactive();
                                                }
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 55 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 933..937

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

                        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 (routeDetails.get(routeDetails.size() - 1).getOccupancySensor() != null) {
                                                    routeDetails.get(routeDetails.size() - 1).getOccupancySensor().setState(Sensor.ACTIVE);
                                                } else {
                                                    routeDetails.get(routeDetails.size() - 1).getBlock().goingActive();
                                                }
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 55 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 941..945

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

                        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

                                                        for (int i = 0; i < routeBlocks.size(); i++) {
                                                            LayoutBlock lbk = routeBlocks.get(i);
                                                            lbk.setBlockExtraColor(realColorXtra.get(i));
                                                            lbk.setBlockTrackColor(realColorStd.get(i));
                                                        }
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 50 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 588..592

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

                        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

                                                for (int i = 0; i < routeBlocks.size(); i++) {
                                                    LayoutBlock lbk = routeBlocks.get(i);
                                                    lbk.setBlockExtraColor(realColorXtra.get(i));
                                                    lbk.setBlockTrackColor(realColorStd.get(i));
                                                }
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 50 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 534..538

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

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

                                                        try {
                                                            blocks = InstanceManager.getDefault(LayoutBlockManager.class).getLayoutBlockConnectivityTools().getLayoutBlocks(startlBlock, destinationLBlock, protectLBlock, false, LayoutBlockConnectivityTools.Routing.NONE);
                                                        } catch (Exception e) {
                                                            //can be considered normal if no free route is found
                                                            errorMessage = e.getMessage();
                        Severity: Major
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 3 other locations - About 40 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1137..1142
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1104..1109
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1067..1072

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

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

                                                        try {
                                                            blocks = InstanceManager.getDefault(LayoutBlockManager.class).getLayoutBlockConnectivityTools().getLayoutBlocks(startlBlock, destinationLBlock, protectLBlock, false, LayoutBlockConnectivityTools.Routing.NONE);
                                                        } catch (Exception e) {
                                                            //can be considered normal if no free route is found
                                                            errorMessage = e.getMessage();
                        Severity: Major
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 3 other locations - About 40 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1125..1130
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1104..1109
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1067..1072

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

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

                                                            try {
                                                                blocks = InstanceManager.getDefault(LayoutBlockManager.class).getLayoutBlockConnectivityTools().getLayoutBlocks(startlBlock, destinationLBlock, protectLBlock, false, LayoutBlockConnectivityTools.Routing.MASTTOMAST);
                                                            } catch (Exception e) {
                                                                errorMessage = e.getMessage();
                                                                //can be considered normal if no free route is found
                        Severity: Major
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 3 other locations - About 40 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1137..1142
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1125..1130
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1067..1072

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

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

                                                try {
                                                    blocks = InstanceManager.getDefault(LayoutBlockManager.class).getLayoutBlockConnectivityTools().getLayoutBlocks(startlBlock, destinationLBlock, protectLBlock, false, LayoutBlockConnectivityTools.Routing.MASTTOMAST);
                                                } catch (Exception e) {
                                                    errorMessage = e.getMessage();
                                                    //can be considered normal if no free route is found
                        Severity: Major
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 3 other locations - About 40 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1137..1142
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1125..1130
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 1104..1109

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

                        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 (log.isDebugEnabled()) {
                                                    log.debug("{} out of loop Set inactive {} {}", getUserName(), routeDetails.get(routeDetails.size() - 2).getUserName(), routeDetails.get(routeDetails.size() - 2).getBlock().getSystemName());  // NOI18N
                                                }
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 40 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 929..931

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

                        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 (log.isDebugEnabled()) {
                                                    log.debug("{} out of loop Set active {} {}", getUserName(), routeDetails.get(routeDetails.size() - 1).getDisplayName(), routeDetails.get(routeDetails.size() - 1).getBlock().getSystemName());  // NOI18N
                                                }
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 40 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 938..940

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

                        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

                                int x = (int) src.getPoint().getPanel().getLocation().getX() + ((src.getPoint().getPanel().getSize().width - w) / 2);
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 30 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 768..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 42.

                        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

                                int y = (int) src.getPoint().getPanel().getLocation().getY() + ((src.getPoint().getPanel().getSize().height - h) / 2);
                        Severity: Minor
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 1 other location - About 30 mins to fix
                        java/src/jmri/jmrit/entryexit/DestinationPoints.java on lines 767..767

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

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

                                            BestPath(LayoutBlock startPro, LayoutBlock sourceProtecting, LayoutBlock destinationBlock, List<LayoutBlock> blocks) {
                                                srcStart = startPro;
                                                srcProtecting = sourceProtecting;
                                                destination = destinationBlock;
                                                listOfBlocks = blocks;
                        Severity: Major
                        Found in java/src/jmri/jmrit/entryexit/DestinationPoints.java and 11 other locations - About 30 mins to fix
                        java/src/jmri/Conditional.java on lines 349..354
                        java/src/jmri/TransitSection.java on lines 48..53
                        java/src/jmri/jmrit/ctc/CTCException.java on lines 21..26
                        java/src/jmri/jmrit/ctc/TrafficLocking.java on lines 109..115
                        java/src/jmri/jmrit/ctc/topology/TopologyInfo.java on lines 25..30
                        java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4451..4456
                        java/src/jmri/jmrit/logixng/util/parser/RecursiveDescentParser.java on lines 95..100
                        java/src/jmri/jmrit/timetable/swing/TimeTablePrintGraph.java on lines 21..26
                        java/src/jmri/jmrit/vsdecoder/listener/ListeningSpot.java on lines 66..71
                        java/src/jmri/jmrix/can/cbus/CbusOpCodes.java on lines 594..599
                        java/src/jmri/jmrix/openlcb/swing/stleditor/StlEditorPane.java on lines 1996..2001

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

                        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