Showing 10,000 of 24,891 total issues

File AutoDispatcher2.py has 8042 lines of code (exceeds 300 allowed). Consider refactoring.
Open

# AutoDispatcher 2
#
#    This script provides full layout automation, using connectivity info
#    provided by Layout Editor panels.
#
Severity: Major
Found in jython/AutoDispatcher2.py - About 3 wks to fix

    Method placeDirectionSensors has a Cognitive Complexity of 1045 (exceeds 20 allowed). Consider refactoring.
    Open

        @Override
        public int placeDirectionSensors() {
            int missingSignalsBB = 0;
            int missingSignalsTurnouts = 0;
            int missingSignalsLevelXings = 0;
    Severity: Minor
    Found in java/src/jmri/implementation/DefaultSection.java - About 3 wks to fix

    Cognitive Complexity

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

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

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

    Further reading

    File LayoutEditor.java has 6615 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    package jmri.jmrit.display.layoutEditor;
    
    import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    
    import java.awt.*;
    Severity: Major
    Found in java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java - About 2 wks to fix

      Method getFacingSignalHead has a Cognitive Complexity of 696 (exceeds 20 allowed). Consider refactoring.
      Open

          @CheckReturnValue
          @CheckForNull
          public SignalHead getFacingSignalHead(
                  @CheckForNull Block facingBlock,
                  @CheckForNull Block protectedBlock) {
      Severity: Minor
      Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.java - About 2 wks 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

      Function propertyChange has a Cognitive Complexity of 687 (exceeds 20 allowed). Consider refactoring.
      Open

          def propertyChange(self, event):
              # Customize bellow for throttles calls:        
              if (event.propertyName == "Value") :  # USB
                  if (event.oldValue.getController() == self.desiredController ) :
                      component = event.oldValue.getComponent().toString()

      Cognitive Complexity

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

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

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

      Further reading

      Method run has a Cognitive Complexity of 642 (exceeds 20 allowed). Consider refactoring.
      Open

          @Override
          public void run() {
              File file = getFile();
              if (file == null) {
                  return;

      Cognitive Complexity

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

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

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

      Further reading

      File panel.js has 4456 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      /**********************************************************************************************
       *  panel Servlet - Draw JMRI panels on browser screen
       *    Retrieves panel xml from JMRI and builds panel client-side from that xml, including
       *    click functions.  Sends and listens for changes to panel elements using the JSON WebSocket server.
       *    If no parm passed, page will list links to available panels.
      Severity: Major
      Found in web/js/panel.js - About 1 wk to fix

        File ConditionalTreeEdit.java has 3618 lines of code (exceeds 300 allowed). Consider refactoring.
        Open

        package jmri.jmrit.conditional;
        
        import java.awt.BorderLayout;
        import java.awt.Color;
        import java.awt.Component;
        Severity: Major
        Found in java/src/jmri/jmrit/conditional/ConditionalTreeEdit.java - About 1 wk to fix

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

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

          Cognitive Complexity

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

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

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

          Further reading

          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

            File LocoNetMessageInterpret.java has 3288 lines of code (exceeds 300 allowed). Consider refactoring.
            Open

            package jmri.jmrix.loconet.messageinterp;
            
            
            import java.time.LocalTime;
            import java.util.ArrayList;

              Method cabUpdateUsb has a Cognitive Complexity of 434 (exceeds 20 allowed). Consider refactoring.
              Open

                  private void cabUpdateUsb() {
              
                      if (firstTime) {
                          try {
                              Thread.sleep(FIRST_TIME_SLEEP); // wait for panel to display
              Severity: Minor
              Found in java/src/jmri/jmrix/nce/cab/NceShowCabPanel.java - About 1 wk to fix

              Cognitive Complexity

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

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

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

              Further reading

              File Train.java has 3077 lines of code (exceeds 300 allowed). Consider refactoring.
              Open

              package jmri.jmrit.operations.trains;
              
              import java.awt.Color;
              import java.beans.PropertyChangeListener;
              import java.io.*;
              Severity: Major
              Found in java/src/jmri/jmrit/operations/trains/Train.java - About 1 wk to fix

                Method readTrainInfo has a Cognitive Complexity of 413 (exceeds 20 allowed). Consider refactoring.
                Open

                    public TrainInfo readTrainInfo(String name) throws org.jdom2.JDOMException, java.io.IOException {
                        log.debug("entered readTrainInfo for {}", name);
                        TrainInfo tInfo = null;
                        int version  = 1;
                        // check if file exists
                Severity: Minor
                Found in java/src/jmri/jmrit/dispatcher/TrainInfoFile.java - About 1 wk to fix

                Cognitive Complexity

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

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

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

                Further reading

                File ConditionalEditFrame.java has 2934 lines of code (exceeds 300 allowed). Consider refactoring.
                Open

                package jmri.jmrit.conditional;
                
                import java.awt.Container;
                import java.awt.Dimension;
                import java.awt.FlowLayout;
                Severity: Major
                Found in java/src/jmri/jmrit/conditional/ConditionalEditFrame.java - About 1 wk to fix

                  File TrackSegmentView.java has 2919 lines of code (exceeds 300 allowed). Consider refactoring.
                  Open

                  package jmri.jmrit.display.layoutEditor;
                  
                  import java.awt.*;
                  import java.awt.event.ActionEvent;
                  import java.awt.geom.*;
                  Severity: Major
                  Found in java/src/jmri/jmrit/display/layoutEditor/TrackSegmentView.java - About 1 wk to fix

                    File DispatcherFrame.java has 2880 lines of code (exceeds 300 allowed). Consider refactoring.
                    Open

                    package jmri.jmrit.dispatcher;
                    
                    import java.awt.BorderLayout;
                    import java.awt.Container;
                    import java.awt.FlowLayout;
                    Severity: Major
                    Found in java/src/jmri/jmrit/dispatcher/DispatcherFrame.java - About 1 wk to fix

                      Function setup_graph_edges has a Cognitive Complexity of 401 (exceeds 20 allowed). Consider refactoring.
                      Open

                          def setup_graph_edges(self):
                              global le
                      
                              if self.logLevel > 0: print "*****************************"
                              if self.logLevel > 0: print "****setup_graph_edges********"
                      Severity: Minor
                      Found in jython/DispatcherSystem/CreateGraph.py - About 1 wk to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Method search has a Cognitive Complexity of 400 (exceeds 20 allowed). Consider refactoring.
                      Open

                          static boolean search(String name, JTextArea text) {
                              String[] names = getTypeAndNames(name);
                              if (log.isDebugEnabled()) {
                                  log.debug("search for {} as {} \"{}\" ({})", name, names[0], names[1], names[2]);
                              }
                      Severity: Minor
                      Found in java/src/jmri/jmrit/beantable/Maintenance.java - About 1 wk to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      File Editor.java has 2778 lines of code (exceeds 300 allowed). Consider refactoring.
                      Open

                      package jmri.jmrit.display;
                      
                      import java.awt.*;
                      import java.awt.datatransfer.DataFlavor;
                      import java.awt.event.*;
                      Severity: Major
                      Found in java/src/jmri/jmrit/display/Editor.java - About 1 wk to fix
                        Severity
                        Category
                        Status
                        Source
                        Language