Showing 24,897 of 24,897 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

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

      var resizeRosterLayout = function() {
          var h = $(window).height();
          var w = $(window).width();
          var bodyFrameOuter = $('#bodyFrameOuter');
          var bodyFrameInner = $('#bodyFrameInner');
      Severity: Major
      Found in web/js/webThrottle.js and 1 other location - About 2 wks to fix
      web/js/CamerawebThrottle.js on lines 908..1063

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

      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

      var resizeRosterLayout = function() {
          var h = $(window).height();
          var w = $(window).width();
          var bodyFrameOuter = $('#bodyFrameOuter');
          var bodyFrameInner = $('#bodyFrameInner');
      Severity: Major
      Found in web/js/CamerawebThrottle.js and 1 other location - About 2 wks to fix
      web/js/webThrottle.js on lines 889..1044

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

      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

      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

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

      <?php
      
      // This script reads the Jacoco Coverage report and sort it by number of missing lines.
      
      // Author: Daniel Bergqvist
      Severity: Major
      Found in scripts/jacoco_sort_report.php and 1 other location - About 1 wk to fix
      help/en/html/doc/Technical/jacoco_sort_report.php on lines 1..318

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

      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

      <?php
      
      // This script reads the Jacoco Coverage report and sort it by number of missing lines.
      
      // Author: Daniel Bergqvist
      Severity: Major
      Found in help/en/html/doc/Technical/jacoco_sort_report.php and 1 other location - About 1 wk to fix
      scripts/jacoco_sort_report.php on lines 1..318

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

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

        Method run has a Cognitive Complexity of 564 (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

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

        $(document).ready(function() {
            /******* Constants available in '$jmri' object
            *   $jmri.powerUNKNOWN = 0;
            *   $jmri.powerON = 2;
            *   $jmri.powerOFF = 4;
        Severity: Major
        Found in web/js/CamerawebThrottle.js and 1 other location - About 1 wk to fix
        web/js/webThrottle.js on lines 146..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 1834.

        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

        $(document).ready(function() {
            /******* Constants available in '$jmri' object
            *   $jmri.powerUNKNOWN = 0;
            *   $jmri.powerON = 2;
            *   $jmri.powerOFF = 4;
        Severity: Major
        Found in web/js/webThrottle.js and 1 other location - About 1 wk to fix
        web/js/CamerawebThrottle.js on lines 148..332

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

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

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

          jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/AAR105ControlStand.py on lines 0..226

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

          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

          jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/RailDriverModernDesktop.py on lines 0..226

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

          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 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;

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

              jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Default.py on lines 0..178
              jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Gamepad.py on lines 0..178
              jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Keyboard.py on lines 0..178
              jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/PLAYSTATIONR3Controller.py on lines 0..178
              jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Stick.py on lines 0..178

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

              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