Showing 24,937 of 24,937 total issues

File ConnectivityUtil.java has 2268 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.stream.Collectors;
Severity: Major
Found in java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.java - About 6 days to fix

    File TimeTableFrame.java has 2265 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    package jmri.jmrit.timetable.swing;
    
    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    Severity: Major
    Found in java/src/jmri/jmrit/timetable/swing/TimeTableFrame.java - About 6 days to fix

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

      Severity: Major
      Found in jython/Jynstruments/ThrottleFrame/SoundOnF8.jyn/SoundOnF8.py and 1 other location - About 6 days to fix
      jython/Jynstruments/ThrottleFrame/Bell.jyn/Bell.py on lines 0..98

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

      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

      Severity: Major
      Found in jython/Jynstruments/ThrottleFrame/Bell.jyn/Bell.py and 1 other location - About 6 days to fix
      jython/Jynstruments/ThrottleFrame/SoundOnF8.jyn/SoundOnF8.py on lines 0..98

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

      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

      <!DOCTYPE html>
      <html>
      <head>
          <title>JMRI Jython Example Files</title>
      </head>
      Severity: Major
      Found in jython/index.php and 2 other locations - About 5 days to fix
      jython/MQTT/index.php on lines 1..167
      jython/ctc/index.php on lines 1..167

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

      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

      <!DOCTYPE html>
      <html>
      <head>
          <title>JMRI Jython Example Files (Topic Subdirectory)</title>
      </head>
      Severity: Major
      Found in jython/MQTT/index.php and 2 other locations - About 5 days to fix
      jython/ctc/index.php on lines 1..167
      jython/index.php on lines 1..167

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

      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

      <!DOCTYPE html>
      <html>
      <head>
          <title>JMRI USS CTC Example Files</title>
      </head>
      Severity: Major
      Found in jython/ctc/index.php and 2 other locations - About 5 days to fix
      jython/MQTT/index.php on lines 1..167
      jython/index.php on lines 1..167

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

      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

      File XNetMessage.java has 2195 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      package jmri.jmrix.lenz;
      
      import java.io.Serializable;
      
      import org.slf4j.Logger;
      Severity: Major
      Found in java/src/jmri/jmrix/lenz/XNetMessage.java - About 5 days to fix

        File DCCppMessage.java has 2186 lines of code (exceeds 300 allowed). Consider refactoring.
        Open

        package jmri.jmrix.dccpp;
        
        import java.util.concurrent.Delayed;
        import java.util.concurrent.TimeUnit;
        import java.util.regex.Matcher;
        Severity: Major
        Found in java/src/jmri/jmrix/dccpp/DCCppMessage.java - About 5 days to fix

          Method draw1 has a Cognitive Complexity of 297 (exceeds 20 allowed). Consider refactoring.
          Open

              @Override
              protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) {
                  if (isBlock && getLayoutBlock() == null) {
                      // Skip the block layer if there is no block assigned.
                      return;
          Severity: Minor
          Found in java/src/jmri/jmrit/display/layoutEditor/LayoutTurnoutView.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

          Setup has 286 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 2022 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

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

                        def createTowerLCCPortDefaults( nodeAddr, nodeNamePrefix ) :
                            print "Creating default port values: " + nodeAddr + " " + nodeNamePrefix
                            nParts = nodeAddr.split( '.')
                            nBase = str(nParts[0]) + "." + str(nParts[1]) + "." + str(nParts[2]) + "." + str(nParts[3]) + "." + str(nParts[4]) + "." + str(nParts[5])
                            baseAddr = 0x00
                        Severity: Major
                        Found in jython/LCC/SetTowerNodeDefaults.py and 1 other location - About 5 days to fix
                        jython/LCC/SetSignalNodeDefaults.py on lines 31..60

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

                        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

                        def createSignalLCCPortDefaults( nodeAddr, nodeNamePrefix ) :
                            print "Creating default port values: " + nodeAddr + " " + nodeNamePrefix
                            nParts = nodeAddr.split( '.')
                            nBase = str(nParts[0]) + "." + str(nParts[1]) + "." + str(nParts[2]) + "." + str(nParts[3]) + "." + str(nParts[4]) + "." + str(nParts[5])
                            baseAddr = 0x00
                        Severity: Major
                        Found in jython/LCC/SetSignalNodeDefaults.py and 1 other location - About 5 days to fix
                        jython/LCC/SetTowerNodeDefaults.py on lines 25..54

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language