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

Summary

Maintainability
F
1 mo
Test Coverage
F
50%

File LayoutBlock.java has 3374 lines of code (exceeds 300 allowed). Consider refactoring.
Open

package jmri.jmrit.display.layoutEditor;

import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
Severity: Major
Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 wk to fix

    Method notifyNeighboursOfRemoval has a Cognitive Complexity of 225 (exceeds 20 allowed). Consider refactoring.
    Open

        private void notifyNeighboursOfRemoval(List<Routes> routesToRemove, Block notifyingblk) {
            String msgPrefix = "From " + this.getDisplayName() + " notify block " + notifyingblk.getDisplayName() + " ";
    
            if (enableDeleteRouteLogging) {
                log.info("{} notifyNeighboursOfRemoval called for routes from {} ===", msgPrefix, notifyingblk.getDisplayName());
    Severity: Minor
    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 4 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

    LayoutBlock has 148 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class LayoutBlock extends AbstractNamedBean implements PropertyChangeListener {
    
        private final boolean enableAddRouteLogging = false;
        private final boolean enableUpdateRouteLogging = false;
        private boolean enableDeleteRouteLogging = false;
    Severity: Major
    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 days to fix

      Method updateRoutingInfo has a Cognitive Complexity of 94 (exceeds 20 allowed). Consider refactoring.
      Open

          void updateRoutingInfo(LayoutBlock src, RoutingPacket update) {
              if (enableUpdateRouteLogging) {
                  log.info("From {} src: {}, block: {}, hopCount: {}, metric: {}, status: {}, packetID: {}", this.getDisplayName(), src.getDisplayName(), update.getBlock().getDisplayName(), update.getHopCount(), update.getMetric(), update.getBlockState(), update.getPacketId());
              }
              Block srcblk = src.getBlock();
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 day 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 getNextBestBlock has a Cognitive Complexity of 87 (exceeds 20 allowed). Consider refactoring.
      Open

          public int getNextBestBlock(Block previousBlock, Block destBlock, List<Integer> excludeBlock, LayoutBlockConnectivityTools.Metric routingMethod) {
              if (enableSearchRouteLogging) {
                  log.info("From {} find best route from {} to {} index {} routingMethod {}", this.getDisplayName(), previousBlock.getDisplayName(), destBlock.getDisplayName(), excludeBlock, routingMethod);
              }
              int bestCount = 965255; // set stupidly high
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 day 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 addThroughPath has a Cognitive Complexity of 83 (exceeds 20 allowed). Consider refactoring.
      Open

          private void addThroughPath(Block srcBlock, Block dstBlock, LayoutEditor panel) {
              // Reset connectivity flag.
              layoutConnectivity = true;
      
              if (srcBlock == dstBlock) {
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 day 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 addNeighbour has a Cognitive Complexity of 66 (exceeds 20 allowed). Consider refactoring.
      Open

          private void addNeighbour(Block addBlock, int direction, int workingDirection) {
              boolean layoutConnectivityBefore = layoutConnectivity;
      
              if (enableAddRouteLogging) {
                  log.info("From {} asked to add block {} as new neighbour {}", this.getDisplayName(),
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 7 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 informNeighbourOfAttachment has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
      Open

          private boolean informNeighbourOfAttachment(LayoutBlock lBlock, Block block, int workingDirection) {
              Adjacencies adj = getAdjacency(block);
              if (adj == null) {
                  if (enableAddRouteLogging) {
                      log.info("From {} neighbour {} has informed us of its attachment to us, however we do not yet have it registered",
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 7 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 notifyNeighboursOfRemoval has 163 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void notifyNeighboursOfRemoval(List<Routes> routesToRemove, Block notifyingblk) {
              String msgPrefix = "From " + this.getDisplayName() + " notify block " + notifyingblk.getDisplayName() + " ";
      
              if (enableDeleteRouteLogging) {
                  log.info("{} notifyNeighboursOfRemoval called for routes from {} ===", msgPrefix, notifyingblk.getDisplayName());
      Severity: Major
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 6 hrs to fix

        Method updateRoutingInfo has 159 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            void updateRoutingInfo(LayoutBlock src, RoutingPacket update) {
                if (enableUpdateRouteLogging) {
                    log.info("From {} src: {}, block: {}, hopCount: {}, metric: {}, status: {}, packetID: {}", this.getDisplayName(), src.getDisplayName(), update.getBlock().getDisplayName(), update.getHopCount(), update.getMetric(), update.getBlockState(), update.getPacketId());
                }
                Block srcblk = src.getBlock();
        Severity: Major
        Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 6 hrs to fix

          Method informNeighbourOfValidRoutes has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
          Open

              private void informNeighbourOfValidRoutes(Block newblock) {
                  // java.sql.Timestamp t1 = new java.sql.Timestamp(System.nanoTime());
                  List<Block> validFromPath = new ArrayList<>();
                  if (enableAddRouteLogging) {
                      log.info("From {} new block {}", this.getDisplayName(), newblock.getDisplayName());
          Severity: Minor
          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 5 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 addThroughPath has 132 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void addThroughPath(Block srcBlock, Block dstBlock, LayoutEditor panel) {
                  // Reset connectivity flag.
                  layoutConnectivity = true;
          
                  if (srcBlock == dstBlock) {
          Severity: Major
          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 5 hrs to fix

            Method blockEditDonePressed has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                void blockEditDonePressed(ActionEvent a) {
                    boolean needsRedraw = false;
                    // check if Sensor changed
                    String newName = NamedBean.normalizeUserName(sensorNameField.getText());
                    if (!(getOccupancySensorName()).equals(newName)) {
            Severity: Major
            Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 4 hrs to fix

              Method updateBlockPaths has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
              Open

                  private void updateBlockPaths(List<LayoutConnectivity> c, LayoutEditor panel) {
                      if (enableAddRouteLogging) {
                          log.info("From {} updateBlockPaths Called", this.getDisplayName());
                      }
                      auxTools = panel.getLEAuxTools();
              Severity: Minor
              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 4 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 layoutDetails has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      BeanItemPanel layoutDetails() {
                          BeanItemPanel layout = new BeanItemPanel();
                          layout.setName(Bundle.getMessage("LayoutEditor"));
              
                          LayoutEditor.setupComboBox(memoryComboBox, false, true, false);
              Severity: Major
              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 3 hrs to fix

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

                    void blockEditDonePressed(ActionEvent a) {
                        boolean needsRedraw = false;
                        // check if Sensor changed
                        String newName = NamedBean.normalizeUserName(sensorNameField.getText());
                        if (!(getOccupancySensorName()).equals(newName)) {
                Severity: Minor
                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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 addNeighbour has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void addNeighbour(Block addBlock, int direction, int workingDirection) {
                        boolean layoutConnectivityBefore = layoutConnectivity;
                
                        if (enableAddRouteLogging) {
                            log.info("From {} asked to add block {} as new neighbour {}", this.getDisplayName(),
                Severity: Major
                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 3 hrs to fix

                  Method informNeighbourOfAttachment has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private boolean informNeighbourOfAttachment(LayoutBlock lBlock, Block block, int workingDirection) {
                          Adjacencies adj = getAdjacency(block);
                          if (adj == null) {
                              if (enableAddRouteLogging) {
                                  log.info("From {} neighbour {} has informed us of its attachment to us, however we do not yet have it registered",
                  Severity: Major
                  Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 3 hrs to fix

                    Method addAllThroughPaths has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
                    Open

                        public void addAllThroughPaths() {
                            if (enableAddRouteLogging) {
                                log.info("Add all ThroughPaths {}", this.getDisplayName());
                            }
                    
                    
                    Severity: Minor
                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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 addThroughPath has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                    Open

                        private void addThroughPath(Adjacencies adj) {
                            Block newAdj = adj.getBlock();
                            int packetFlow = adj.getPacketFlow();
                    
                            if (enableAddRouteLogging) {
                    Severity: Minor
                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Method updateBlockPaths has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private void updateBlockPaths(List<LayoutConnectivity> c, LayoutEditor panel) {
                            if (enableAddRouteLogging) {
                                log.info("From {} updateBlockPaths Called", this.getDisplayName());
                            }
                            auxTools = panel.getLEAuxTools();
                    Severity: Major
                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                      Method informNeighbourOfValidRoutes has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private void informNeighbourOfValidRoutes(Block newblock) {
                              // java.sql.Timestamp t1 = new java.sql.Timestamp(System.nanoTime());
                              List<Block> validFromPath = new ArrayList<>();
                              if (enableAddRouteLogging) {
                                  log.info("From {} new block {}", this.getDisplayName(), newblock.getDisplayName());
                      Severity: Major
                      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                        Method getNextBestBlock has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public int getNextBestBlock(Block previousBlock, Block destBlock, List<Integer> excludeBlock, LayoutBlockConnectivityTools.Metric routingMethod) {
                                if (enableSearchRouteLogging) {
                                    log.info("From {} find best route from {} to {} index {} routingMethod {}", this.getDisplayName(), previousBlock.getDisplayName(), destBlock.getDisplayName(), excludeBlock, routingMethod);
                                }
                                int bestCount = 965255; // set stupidly high
                        Severity: Major
                        Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                          Method blockRoutingDetails has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  BeanItemPanel blockRoutingDetails() {
                                      BeanItemPanel routing = new BeanItemPanel();
                                      routing.setName("Routing");
                          
                                      routing.addItem(new BeanEditItem(metricField, "Block Metric", "set the cost for going over this block"));
                          Severity: Major
                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                            Method propertyChange has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Override
                                public void propertyChange(PropertyChangeEvent e) {
                            
                                    switch (e.getPropertyName()) {
                                        case "NewRoute": {
                            Severity: Major
                            Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                              Method updatePaths has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                              Open

                                  public void updatePaths() {
                                      // Update paths is called by the panel, turnouts, xings, track segments etc
                                      if ((block != null) && !panels.isEmpty()) {
                                          // a block is attached and this LayoutBlock is used
                                          // initialize connectivity as defined in first Layout Editor panel
                              Severity: Minor
                              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Method validateMemory has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                              Open

                                  public Memory validateMemory(String memName, Component openFrame) {
                                      // check if anything entered
                                      if ((memName == null) || memName.isEmpty()) {
                                          // no memory entered
                                          return null;
                              Severity: Minor
                              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Method addRouteFromNeighbour has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  void addRouteFromNeighbour(LayoutBlock src, RoutingPacket update) {
                                      if (enableAddRouteLogging) {
                                          // log.info("From " + this.getDisplayName() + " packet to be added from neighbour " + src.getDisplayName());
                                          log.info("From {} src: {}, block: {}, hopCount: {}, metric: {}, status: {}, packetID: {}", this.getDisplayName(), src.getDisplayName(), update.getBlock().getDisplayName(), update.getHopCount(), update.getMetric(), update.getBlockState(), update.getPacketId());
                                      }
                              Severity: Major
                              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

                                Method addAllThroughPaths has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public void addAllThroughPaths() {
                                        if (enableAddRouteLogging) {
                                            log.info("Add all ThroughPaths {}", this.getDisplayName());
                                        }
                                
                                
                                Severity: Major
                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 2 hrs to fix

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

                                      protected void updateNeighbourPacketFlow(Adjacencies neighbour, final int flow) {
                                          if (neighbour.getPacketFlow() == flow) {
                                              return;
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                    Method removeAdjacency has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                        private void removeAdjacency(LayoutBlock layoutBlock) {
                                            if (enableDeleteRouteLogging) {
                                                log.info("From {} Adjacency to be removed {}", this.getDisplayName(), layoutBlock.getDisplayName());
                                            }
                                            Block removedBlock = layoutBlock.getBlock();
                                    Severity: Minor
                                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr 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 addRouteToNeighbours has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        void addRouteToNeighbours(Routes ro) {
                                            if (enableAddRouteLogging) {
                                                log.info("From {} Add route to neighbour", this.getDisplayName());
                                            }
                                            Block nextHop = ro.getNextBlock();
                                    Severity: Minor
                                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

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

                                          private void removeAdjacency(LayoutBlock layoutBlock) {
                                              if (enableDeleteRouteLogging) {
                                                  log.info("From {} Adjacency to be removed {}", this.getDisplayName(), layoutBlock.getDisplayName());
                                              }
                                              Block removedBlock = layoutBlock.getBlock();
                                      Severity: Minor
                                      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                        Method setBlockMetric has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            void setBlockMetric() {
                                                if (!defaultMetric) {
                                                    return;
                                                }
                                                if (enableUpdateRouteLogging) {
                                        Severity: Minor
                                        Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                          Method initializeLayoutBlock has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              public void initializeLayoutBlock() {
                                                  // get/create a Block object corresponding to this LayoutBlock
                                                  block = null;   // assume failure (pessimist!)
                                                  String userName = getUserName();
                                                  if ((userName != null) && !userName.isEmpty()) {
                                          Severity: Minor
                                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                            Method updatePaths has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public void updatePaths() {
                                                    // Update paths is called by the panel, turnouts, xings, track segments etc
                                                    if ((block != null) && !panels.isEmpty()) {
                                                        // a block is attached and this LayoutBlock is used
                                                        // initialize connectivity as defined in first Layout Editor panel
                                            Severity: Minor
                                            Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                              Method validateMemory has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  public Memory validateMemory(String memName, Component openFrame) {
                                                      // check if anything entered
                                                      if ((memName == null) || memName.isEmpty()) {
                                                          // no memory entered
                                                          return null;
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                Method updateActiveThroughPaths has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    void updateActiveThroughPaths(ThroughPaths tp, boolean active) {
                                                        if (enableUpdateRouteLogging) {
                                                            log.info("We have been notified that a through path has changed state");
                                                        }
                                                
                                                
                                                Severity: Minor
                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                  Method propertyChange has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                                                  Open

                                                      @Override
                                                      public void propertyChange(PropertyChangeEvent e) {
                                                  
                                                          switch (e.getPropertyName()) {
                                                              case "NewRoute": {
                                                  Severity: Minor
                                                  Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr 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 addThroughPath has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      private void addThroughPath(Block srcBlock, Block dstBlock) {
                                                          if (enableAddRouteLogging) {
                                                              log.info("Block {}.addThroughPath(src:{}, dst: {})",
                                                                      this.getDisplayName(), srcBlock.getDisplayName(), dstBlock.getDisplayName());
                                                          }
                                                  Severity: Minor
                                                  Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

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

                                                        public Sensor validateSensor(String sensorName, Component openFrame) {
                                                            // check if anything entered
                                                            if ((sensorName == null) || sensorName.isEmpty()) {
                                                                // no sensor name entered
                                                                if (occupancyNamedSensor != null) {
                                                    Severity: Minor
                                                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                      Method addThroughPath has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          private void addThroughPath(Adjacencies adj) {
                                                              Block newAdj = adj.getBlock();
                                                              int packetFlow = adj.getPacketFlow();
                                                      
                                                              if (enableAddRouteLogging) {
                                                      Severity: Minor
                                                      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                        Method handleBlockChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            void handleBlockChange(PropertyChangeEvent e) {
                                                                // Update memory object if there is one
                                                                Memory m = getMemory();
                                                                if ((m != null) && (block != null) && !suppressNameUpdate) {
                                                                    // copy block value to memory if there is a value
                                                        Severity: Minor
                                                        Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                          Method addThroughPath has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                                                          Open

                                                              private void addThroughPath(Block srcBlock, Block dstBlock) {
                                                                  if (enableAddRouteLogging) {
                                                                      log.info("Block {}.addThroughPath(src:{}, dst: {})",
                                                                              this.getDisplayName(), srcBlock.getDisplayName(), dstBlock.getDisplayName());
                                                                  }
                                                          Severity: Minor
                                                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr 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 setTurnoutList has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                  void setTurnoutList(List<LayoutTrackExpectedState<LayoutTurnout>> turnouts) {
                                                                      if (!_turnouts.isEmpty()) {
                                                                          Set<Turnout> en = _turnouts.keySet();
                                                                          en.forEach((listTurnout) -> listTurnout.removePropertyChangeListener(this));
                                                                      }
                                                          Severity: Minor
                                                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

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

                                                                private void removeRouteFromNeighbour(LayoutBlock src, RoutingPacket update) {
                                                                    InstanceManager.getDefault(LayoutBlockManager.class).setLastRoutingChange();
                                                                    Block srcblk = src.getBlock();
                                                                    Block destblk = update.getBlock();
                                                                    String msgPrefix = "From " + this.getDisplayName() + " notify block " + srcblk.getDisplayName() + " ";
                                                            Severity: Minor
                                                            Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                              Method getOccupancy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                  public int getOccupancy() {
                                                                      if (occupancyNamedSensor == null) {
                                                                          Sensor s = null;
                                                                          if (!occupancySensorName.isEmpty()) {
                                                                              s = InstanceManager.sensorManagerInstance().getSensor(occupancySensorName);
                                                              Severity: Minor
                                                              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 1 hr to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                                if (routingMethod == LayoutBlockConnectivityTools.Metric.METRIC) {
                                                                                                    if (ro.getMetric() < bestCount) {
                                                                                                        bestIndex = i;
                                                                                                        bestCount = ro.getMetric();
                                                                                                    }
                                                                Severity: Major
                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                                  if (enableSearchRouteLogging) {
                                                                                                      log.info("valid through path");
                                                                                                  }
                                                                  Severity: Major
                                                                  Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                                    if (enableSearchRouteLogging) {
                                                                                                        log.info("getNextBlock is this block therefore directly connected");
                                                                                                    }
                                                                    Severity: Major
                                                                    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 45 mins to fix

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                                      if (enableDeleteRouteLogging) {
                                                                                                          log.info("{} we could of potentially sent the route to {}", msgPrefix, neighblock.getDisplayName());
                                                                                                      }
                                                                      Severity: Major
                                                                      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 45 mins to fix

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                                        if (!validThroughPath(nextHop, neighblock)) {
                                                                                                            if (enableDeleteRouteLogging) {
                                                                                                                log.info("{} there is no other valid path so will mark for removal", msgPrefix);
                                                                                                            }
                                                                                                            validNeighboursToNotify.add(neighblock);
                                                                        Severity: Major
                                                                        Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 45 mins to fix

                                                                          Method vetoableChange has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                                                                          Open

                                                                              @Override
                                                                              public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
                                                                                  if ("CanDelete".equals(evt.getPropertyName())) {    // NOI18N
                                                                                      if (evt.getOldValue() instanceof Sensor) {
                                                                                          if (evt.getOldValue().equals(getOccupancySensor())) {
                                                                          Severity: Minor
                                                                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 35 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

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                              return;
                                                                          Severity: Major
                                                                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                        return false;
                                                                            Severity: Major
                                                                            Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                  return;
                                                                              Severity: Major
                                                                              Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java - About 30 mins to fix

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

                                                                                    void addRouteFromNeighbour(LayoutBlock src, RoutingPacket update) {
                                                                                        if (enableAddRouteLogging) {
                                                                                            // log.info("From " + this.getDisplayName() + " packet to be added from neighbour " + src.getDisplayName());
                                                                                            log.info("From {} src: {}, block: {}, hopCount: {}, metric: {}, status: {}, packetID: {}", this.getDisplayName(), src.getDisplayName(), update.getBlock().getDisplayName(), update.getHopCount(), update.getMetric(), update.getBlockState(), update.getPacketId());
                                                                                        }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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

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

                                                                                    protected void updateNeighbourPacketFlow(Adjacencies neighbour, final int flow) {
                                                                                        if (neighbour.getPacketFlow() == flow) {
                                                                                            return;
                                                                                        }
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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

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

                                                                                    void updateActiveThroughPaths(ThroughPaths tp, boolean active) {
                                                                                        if (enableUpdateRouteLogging) {
                                                                                            log.info("We have been notified that a through path has changed state");
                                                                                        }
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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

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

                                                                                        @Override
                                                                                        public void propertyChange(PropertyChangeEvent e) {
                                                                                            if (e.getPropertyName().equals("KnownState")) {
                                                                                                Turnout srcTurnout = (Turnout) e.getSource();
                                                                                                int newVal = (Integer) e.getNewValue();
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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

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

                                                                                            if (panels.size() > 1) {
                                                                                                for (int i = 1; i < panels.size(); i++) {
                                                                                                    if (c.size() < panels.get(i).getLEAuxTools().
                                                                                                            getConnectivityList(this).size()) {
                                                                                                        panel = panels.get(i);
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 3 hrs to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1473..1502

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

                                                                                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 (panels.size() > 1) {
                                                                                                for (int i = 1; i < panels.size(); i++) {
                                                                                                    if (c.size() < panels.get(i).getLEAuxTools().
                                                                                                            getConnectivityList(this).size()) {
                                                                                                        panel = panels.get(i);
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 3 hrs to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2395..2423

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                    @Override
                                                                                    public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
                                                                                        if ("CanDelete".equals(evt.getPropertyName())) {    // NOI18N
                                                                                            if (evt.getOldValue() instanceof Sensor) {
                                                                                                if (evt.getOldValue().equals(getOccupancySensor())) {
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 2 hrs to fix
                                                                                java/src/jmri/Block.java on lines 1304..1329

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

                                                                                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

                                                                                    Routes getBestRouteByMetric(Block dest) {
                                                                                        // int bestHopCount = 255;
                                                                                        int bestMetric = 965000;
                                                                                        int bestIndex = -1;
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3556..3573

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

                                                                                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

                                                                                    Routes getBestRouteByHop(Block dest) {
                                                                                        int bestHopCount = 255;
                                                                                        // int bestMetric = 965000;
                                                                                        int bestIndex = -1;
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3537..3554

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

                                                                                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

                                                                                        try {
                                                                                            MDC.put("loggingDisabled", connection.getClass().getName());
                                                                                            tmpdtos = connection.getTurnoutList(block, dstBlock, srcBlock, true);
                                                                                            MDC.remove("loggingDisabled");
                                                                                        } catch (java.lang.NullPointerException ex) {
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2475..2486

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

                                                                                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

                                                                                        try {
                                                                                            MDC.put("loggingDisabled", connection.getClass().getCanonicalName());
                                                                                            stod = connection.getTurnoutList(block, srcBlock, dstBlock, true);
                                                                                            MDC.remove("loggingDisabled");
                                                                                        } catch (java.lang.NullPointerException ex) {
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2493..2504

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

                                                                                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 j = routes.size() - 1; j > -1; j--) {
                                                                                                            Routes ro = routes.get(j);
                                                                                                            if ((ro.getDestBlock() == addBlock)
                                                                                                                    && (ro.getNextBlock() == this.getBlock())) {
                                                                                                                adj.removeRouteAdvertisedToNeighbour(ro);
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1723..1729

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

                                                                                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 j = routes.size() - 1; j > -1; j--) {
                                                                                                    Routes ro = routes.get(j);
                                                                                                    if ((ro.getDestBlock() == block) && (ro.getNextBlock() == this.getBlock())) {
                                                                                                        adj.removeRouteAdvertisedToNeighbour(ro);
                                                                                                        routes.remove(j);
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1597..1604

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

                                                                                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

                                                                                        RoutingPacket(int packetType, Block blk, int hopCount, int packetMetric, float length, int blockstate, Integer packetRef) {
                                                                                            this.packetType = packetType;
                                                                                            this.block = blk;
                                                                                            this.hopCount = hopCount;
                                                                                            this.packetMetric = packetMetric;
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrix/powerline/InsteonSequence.java on lines 134..142

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

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

                                                                                    public int getBlockHopCount(Block destination, Block nextBlock) {
                                                                                        if ((destination == nextBlock) && (isValidNeighbour(nextBlock))) {
                                                                                            return 1;
                                                                                        }
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4227..4240
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4254..4267

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

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

                                                                                    public int getBlockMetric(Block destination, Block nextBlock) {
                                                                                        if ((destination == nextBlock) && (isValidNeighbour(nextBlock))) {
                                                                                            return 1;
                                                                                        }
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4200..4213
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4254..4267

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

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

                                                                                    public float getBlockLength(Block destination, Block nextBlock) {
                                                                                        if ((destination == nextBlock) && (isValidNeighbour(nextBlock))) {
                                                                                            return 1;
                                                                                        }
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4200..4213
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4227..4240

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

                                                                                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 (!memoryName.equals(newName)) {
                                                                                                        // memory has changed
                                                                                                        setMemory(validateMemory(newName, editLayoutBlockFrame), newName);
                                                                                                        if (getMemory() == null) {
                                                                                                            // invalid memory entered
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1064..1076

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

                                                                                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 (!memoryName.equals(newName)) {
                                                                                            // memory has changed
                                                                                            setMemory(validateMemory(newName, editLayoutBlockFrame), newName);
                                                                                            if (getMemory() == null) {
                                                                                                // invalid memory entered
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1222..1234

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

                                                                                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 (ro.getDestBlock() == removedBlock) {
                                                                                                if (enableDeleteRouteLogging) {
                                                                                                    log.info("From {} route to {} from block {} to be removed triggered by adjancey removal as dest block has been removed", this.getDisplayName(), routes.get(j).getDestBlock().getDisplayName(), routes.get(j).getNextBlock().getDisplayName());
                                                                                                }
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2028..2038

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

                                                                                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 (ro.getNextBlock() == removedBlock) {
                                                                                                if (enableDeleteRouteLogging) {
                                                                                                    log.info("From {} route to {} from block {} to be removed triggered by adjancey removal", this.getDisplayName(), routes.get(j).getDestBlock().getDisplayName(), routes.get(j).getNextBlock().getDisplayName());
                                                                                                }
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 1 hr to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2018..2028

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

                                                                                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 (throughPaths.get(i).getDestinationBlock() == removedBlock) {
                                                                                                // only mark for removal if the destination isn't in the adjcency table
                                                                                                if (getAdjacency(throughPaths.get(i).getDestinationBlock()) == null) {
                                                                                                    if (enableDeleteRouteLogging) {
                                                                                                        log.info("remove {} to {}", throughPaths.get(i).getSourceBlock().getDisplayName(), throughPaths.get(i).getDestinationBlock().getDisplayName());
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 50 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1945..1953

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 62.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                            for (int i = throughPaths.size() - 1; i > -1; i--) {
                                                                                                if (throughPaths.get(i).getSourceBlock() == neighBlock) {
                                                                                                    throughPaths.remove(i);
                                                                                                    firePropertyChange("through-path-removed", null, null);
                                                                                                }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 50 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2084..2089

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 62.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                            for (int i = throughPaths.size() - 1; i > -1; i--) {
                                                                                                if (throughPaths.get(i).getDestinationBlock() == neighBlock) {
                                                                                                    throughPaths.remove(i);
                                                                                                    firePropertyChange("through-path-removed", null, null);
                                                                                                }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 50 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 2100..2105

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 62.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                            if (throughPaths.get(i).getSourceBlock() == removedBlock) {
                                                                                                // only mark for removal if the source isn't in the adjcency table
                                                                                                if (getAdjacency(throughPaths.get(i).getSourceBlock()) == null) {
                                                                                                    if (enableDeleteRouteLogging) {
                                                                                                        log.info("remove {} to {}", throughPaths.get(i).getSourceBlock().getDisplayName(), throughPaths.get(i).getDestinationBlock().getDisplayName());
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 50 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1953..1961

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 62.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                        if (m == null) {
                                                                                            // There is no memory corresponding to this name
                                                                                            JmriJOptionPane.showMessageDialog(openFrame,
                                                                                                    java.text.MessageFormat.format(Bundle.getMessage("Error16"),
                                                                                                            new Object[]{memName}),
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 45 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 323..330

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

                                                                                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 (s == null) {
                                                                                            // There is no sensor corresponding to this name
                                                                                            JmriJOptionPane.showMessageDialog(openFrame,
                                                                                                    java.text.MessageFormat.format(Bundle.getMessage("Error7"),
                                                                                                            new Object[]{sensorName}),
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 45 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 382..389

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

                                                                                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

                                                                                                    RoutingPacket update = new RoutingPacket(ADDITION, ro.getDestBlock(), ro.getHopCount() + 1, (ro.getMetric() + metric), (ro.getLength() + block.getLengthMm()), -1, getNextPacketID());
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 40 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1851..1851

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

                                                                                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

                                                                                                        RoutingPacket update = new RoutingPacket(ADDITION, ro.getDestBlock(), ro.getHopCount() + 1, (ro.getMetric() + metric), (ro.getLength() + block.getLengthMm()), -1, getNextPacketID());
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 40 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1835..1835

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

                                                                                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 getRouteIndex(Routes r) {
                                                                                        for (int i = 0; i < routes.size(); i++) {
                                                                                            if (routes.get(i) == r) {
                                                                                                return i;
                                                                                            }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 40 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3879..3886

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

                                                                                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 getNeighbourIndex(Adjacencies adj) {
                                                                                        for (int i = 0; i < neighbours.size(); i++) {
                                                                                            if (neighbours.get(i) == adj) {
                                                                                                return i;
                                                                                            }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 40 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4179..4186

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

                                                                                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

                                                                                    @Nonnull
                                                                                    List<Block> getThroughPathDestinationBySource(Block source) {
                                                                                        List<Block> a = new ArrayList<>();
                                                                                
                                                                                        for (ThroughPaths throughPath : throughPaths) {
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 40 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4545..4555

                                                                                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

                                                                                    @Nonnull
                                                                                    List<Block> getThroughPathSourceByDestination(Block dest) {
                                                                                        List<Block> a = new ArrayList<>();
                                                                                
                                                                                        for (ThroughPaths throughPath : throughPaths) {
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 40 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 4557..4567

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

                                                                                    List<Routes> getDestRoutes(Block dstBlock) {
                                                                                        List<Routes> rtr = new ArrayList<>();
                                                                                        for (Routes route : routes) {
                                                                                            if (route.getDestBlock() == dstBlock) {
                                                                                                rtr.add(route);
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 35 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3080..3089
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3266..3274

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

                                                                                    @Nonnull
                                                                                    List<Routes> getRouteByNeighbour(Block blk) {
                                                                                        List<Routes> rtr = new ArrayList<>();
                                                                                        for (Routes route : routes) {
                                                                                            if (route.getNextBlock() == blk) {
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 35 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3250..3258
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3266..3274

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

                                                                                    List<Routes> getNextRoutes(Block nxtBlock) {
                                                                                        List<Routes> rtr = new ArrayList<>();
                                                                                        for (Routes route : routes) {
                                                                                            if (route.getNextBlock() == nxtBlock) {
                                                                                                rtr.add(route);
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 35 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3080..3089
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3250..3258

                                                                                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

                                                                                            return "Routes(dst:" + destBlock + ", nxt:" + nextBlock
                                                                                                    + ", hop:" + hopCount + ", dir:" + direction
                                                                                                    + ", met:" + routeMetric + ", len: " + length + ")";
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 35 mins to fix
                                                                                java/src/jmri/jmrit/vsdecoder/VSDConfig.java on lines 112..117

                                                                                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

                                                                                        if (enableAddRouteLogging) {
                                                                                            // log.info("From " + this.getDisplayName() + " packet to be added from neighbour " + src.getDisplayName());
                                                                                            log.info("From {} src: {}, block: {}, hopCount: {}, metric: {}, status: {}, packetID: {}", this.getDisplayName(), src.getDisplayName(), update.getBlock().getDisplayName(), update.getHopCount(), update.getMetric(), update.getBlockState(), update.getPacketId());
                                                                                        }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 35 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3292..3294

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

                                                                                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 (enableUpdateRouteLogging) {
                                                                                            log.info("From {} src: {}, block: {}, hopCount: {}, metric: {}, status: {}, packetID: {}", this.getDisplayName(), src.getDisplayName(), update.getBlock().getDisplayName(), update.getHopCount(), update.getMetric(), update.getBlockState(), update.getPacketId());
                                                                                        }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 35 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 3657..3660

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

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

                                                                                                    if (((tlb1 == mlb1) && (tlb2 == mlb2))
                                                                                                            || ((tlb1 == mlb2) && (tlb2 == mlb1))) {
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 30 mins to fix
                                                                                java/src/jmri/implementation/DefaultConditional.java on lines 552..553
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutTurnoutView.java on lines 1283..1284

                                                                                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

                                                                                        ThroughPaths(Block srcBlock, Path srcPath, Block destBlock, Path dstPath) {
                                                                                            sourceBlock = srcBlock;
                                                                                            destinationBlock = destBlock;
                                                                                            sourcePath = srcPath;
                                                                                            destinationPath = dstPath;
                                                                                Severity: Major
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.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/entryexit/DestinationPoints.java on lines 1021..1026
                                                                                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

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

                                                                                            if ((newPacketFlow == RXTX) || (newPacketFlow == RXONLY)) {
                                                                                                lBlock.addPropertyChangeListener(this);
                                                                                            } else {
                                                                                                lBlock.removePropertyChangeListener(this);
                                                                                            }
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 30 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1574..1579

                                                                                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

                                                                                                if ((workingDirection == RXTX) || (workingDirection == RXONLY)) {
                                                                                                    blk.addPropertyChangeListener(this);
                                                                                                    // log.info("From {} add property change {}", this.getDisplayName(), blk.getDisplayName());
                                                                                                } else {
                                                                                                    blk.removePropertyChangeListener(this);
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 1 other location - About 30 mins to fix
                                                                                java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java on lines 1716..1720

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

                                                                                        void setPacketFlow(int flow) {
                                                                                            if (flow != packetFlow) {
                                                                                                int oldFlow = packetFlow;
                                                                                                packetFlow = flow;
                                                                                                firePropertyChange("neighbourpacketflow", oldFlow, packetFlow);
                                                                                Severity: Minor
                                                                                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java and 2 other locations - About 30 mins to fix
                                                                                java/src/jmri/implementation/AbstractTurnout.java on lines 124..130
                                                                                java/src/jmri/implementation/DefaultConditional.java on lines 990..997

                                                                                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