Showing 10,007 of 24,911 total issues

Setup has 284 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Setup extends PropertyChangeSupport implements InstanceManagerAutoDefault, Disposable {

    public static final String NONE = "";

    // scale ratios from NMRA
Severity: Major
Found in java/src/jmri/jmrit/operations/setup/Setup.java - About 5 days to fix

    File RobotThrottle3.py has 2083 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    # This script runs a loco around the track, controlling the speed
    # according to signals and following the blocks.
    #
    # Author: Ken Cameron, copyright 2009,2010
    # Part of the JMRI distribution
    Severity: Major
    Found in jython/RobotThrottle3.py - About 5 days to fix

      File CamerawebThrottle.js has 2039 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      /**********************************************************************************************
      *
      * Javascript for 'webThrottle.html'
      *
      * This script defines the web throttle behaviour.
      Severity: Major
      Found in web/js/CamerawebThrottle.js - About 5 days to fix

        File Track.java has 2013 lines of code (exceeds 300 allowed). Consider refactoring.
        Open

        package jmri.jmrit.operations.locations;
        
        import java.util.*;
        
        import org.jdom2.Attribute;
        Severity: Major
        Found in java/src/jmri/jmrit/operations/locations/Track.java - About 5 days to fix

          File webThrottle.js has 2003 lines of code (exceeds 300 allowed). Consider refactoring.
          Open

          /**********************************************************************************************
          *
          * Javascript for 'webThrottle.html'
          *
          * This script defines the web throttle behaviour.
          Severity: Major
          Found in web/js/webThrottle.js - About 5 days to fix

            File WarrantFrame.java has 1988 lines of code (exceeds 300 allowed). Consider refactoring.
            Open

            package jmri.jmrit.logix;
            
            import java.awt.BorderLayout;
            import java.awt.Color;
            import java.awt.Component;
            Severity: Major
            Found in java/src/jmri/jmrit/logix/WarrantFrame.java - About 5 days to fix

              Train has 262 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class Train extends PropertyChangeSupport implements Identifiable, PropertyChangeListener {
              
                  /*
                   * WARNING DO NOT LOAD CAR OR ENGINE MANAGERS WHEN Train.java IS CREATED IT
                   * CAUSES A RECURSIVE LOOP AT LOAD TIME, SEE EXAMPLES BELOW CarManager
              Severity: Major
              Found in java/src/jmri/jmrit/operations/trains/Train.java - About 5 days to fix

                Method checkLocationsLoop has a Cognitive Complexity of 272 (exceeds 20 allowed). Consider refactoring.
                Open

                    private boolean checkLocationsLoop() {
                        boolean noIssues = true;
                        // only report car type not serviced once
                        List<String> ignoreType = new ArrayList<String>();
                        for (Location destination : locationManager.getLocationsByNameList()) {

                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 LayoutBlockManager.java has 1962 lines of code (exceeds 300 allowed). Consider refactoring.
                Open

                package jmri.jmrit.display.layoutEditor;
                
                import java.util.ArrayList;
                import java.util.List;
                import java.util.Set;
                Severity: Major
                Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.java - About 5 days to fix

                  Function JMRI has 1034 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          JMRI: function (url, bindings) {
                              var log = new Logger();
                              var jmri = new Object();
                              if (typeof (url) === 'string') {
                                  jmri.url = url;
                  Severity: Major
                  Found in web/js/jquery.jmri.js - About 5 days to fix

                    Method getTrackNode has a Cognitive Complexity of 262 (exceeds 20 allowed). Consider refactoring.
                    Open

                        @CheckReturnValue
                        @CheckForNull
                        public TrackNode getTrackNode(
                                @Nonnull LayoutTrack currentNode,
                                HitPointType currentNodeType,
                    Severity: Minor
                    Found in java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.java - About 5 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

                    Function processPanelXML has 1005 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function processPanelXML($returnedData, $success, $xhr) {
                    
                        $('div#messageText').text("rendering panel from xml, please wait...");
                        $("#activity-alert").addClass("show").removeClass("hidden");
                        var $xml = $($returnedData);  //jQuery-ize returned data for easier access
                    Severity: Major
                    Found in web/js/panel.js - About 5 days to fix

                      File PaneProgPane.java has 1885 lines of code (exceeds 300 allowed). Consider refactoring.
                      Open

                      package jmri.jmrit.symbolicprog.tabbedframe;
                      
                      import java.awt.Color;
                      import java.awt.Component;
                      import java.awt.Font;
                      Severity: Major
                      Found in java/src/jmri/jmrit/symbolicprog/tabbedframe/PaneProgPane.java - About 5 days to fix

                        File NodeConfigManagerFrame.java has 1868 lines of code (exceeds 300 allowed). Consider refactoring.
                        Open

                        package jmri.jmrix.cmri.serial.nodeconfigmanager;
                        
                        import java.awt.*;
                        import java.awt.event.ActionEvent;
                        import java.awt.event.ItemEvent;

                          Method getFacingBean has a Cognitive Complexity of 255 (exceeds 20 allowed). Consider refactoring.
                          Open

                              @CheckReturnValue
                              @CheckForNull
                              public NamedBean getFacingBean(@CheckForNull Block facingBlock,
                                      @CheckForNull Block protectedBlock,
                                      @CheckForNull LayoutEditor panel, Class< ?> T) {
                          Severity: Minor
                          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.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

                          Method getTurnoutSetting has a Cognitive Complexity of 252 (exceeds 20 allowed). Consider refactoring.
                          Open

                              private Integer getTurnoutSetting(
                                      @Nonnull LayoutTurnout layoutTurnout, HitPointType cType, boolean suppress) {
                                  prevConnectTrack = layoutTurnout;
                                  int setting = Turnout.THROWN;
                                  LayoutTurnout.TurnoutType tType = layoutTurnout.getTurnoutType();
                          Severity: Minor
                          Found in java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.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

                          File NceConsistEditPanel.java has 1804 lines of code (exceeds 300 allowed). Consider refactoring.
                          Open

                          package jmri.jmrix.nce.consist;
                          
                          import java.awt.Dimension;
                          import java.awt.GridBagConstraints;
                          import java.awt.GridBagLayout;
                          Severity: Major
                          Found in java/src/jmri/jmrix/nce/consist/NceConsistEditPanel.java - About 4 days to fix

                            Method buildSwitchList has a Cognitive Complexity of 242 (exceeds 20 allowed). Consider refactoring.
                            Open

                                public void buildSwitchList(Location location) {
                            
                                    boolean append = false; // add text to end of file when true
                                    boolean checkFormFeed = true; // used to determine if FF needed between trains
                            
                            
                            Severity: Minor
                            Found in java/src/jmri/jmrit/operations/trains/TrainSwitchLists.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

                            File SignallingPanel.java has 1729 lines of code (exceeds 300 allowed). Consider refactoring.
                            Open

                            package jmri.jmrit.signalling;
                            
                            import java.awt.BorderLayout;
                            import java.awt.Component;
                            import java.awt.Container;
                            Severity: Major
                            Found in java/src/jmri/jmrit/signalling/SignallingPanel.java - About 4 days to fix

                              Method cabUpdateSerial has a Cognitive Complexity of 233 (exceeds 20 allowed). Consider refactoring.
                              Open

                                  private void cabUpdateSerial() {
                              
                                      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 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

                              Severity
                              Category
                              Status
                              Source
                              Language