Showing 24,783 of 24,783 total issues

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

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
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/USBClassicGamepad2.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

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/PLAYSTATIONR3Controller.py on lines 0..178
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Stick.py on lines 0..178
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/USBClassicGamepad2.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

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/USBClassicGamepad2.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

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/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
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/USBClassicGamepad2.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

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

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

        case 'roster':
            var rg = loadLocalInfo('webThrottle.rosterGroup');
            if (rg || rg == '') $rosterGroup = rg; else saveLocalInfo('webThrottle.rosterGroup', $rosterGroup);
            $help.push(
                'Web Throttle for JMRI ' + jmriVersion + ' controlling \'' + railroadName + '\'' +
Severity: Major
Found in web/js/webThrottle.js and 1 other location - About 1 wk to fix
web/js/CamerawebThrottle.js on lines 457..559

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

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

        case 'roster':
            var rg = loadLocalInfo('webThrottle.rosterGroup');
            if (rg || rg == '') $rosterGroup = rg; else saveLocalInfo('webThrottle.rosterGroup', $rosterGroup);
            $help.push(
                'Web Throttle for JMRI ' + jmriVersion + ' controlling \'' + railroadName + '\'' +
Severity: Major
Found in web/js/CamerawebThrottle.js and 1 other location - About 1 wk to fix
web/js/webThrottle.js on lines 455..557

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

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

jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/LogitechDualAction.py on lines 0..174
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Thrustmasterdualanalog32.py on lines 0..174

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

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

jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/LogitechDualAction.py on lines 0..174
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/XBCDXBoxGamepad.py on lines 0..184

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

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

jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/Thrustmasterdualanalog32.py on lines 0..174
jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/XBCDXBoxGamepad.py on lines 0..184

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

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

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

          var resizeHeader = function() {
              $nextBlockTop = 0;
              var headerWidth = $(window).width();
              var headerHeight = $sizeCtrlPercent * $headerHeightRef;
              var header = $('#header');
          Severity: Major
          Found in web/js/webThrottle.js and 1 other location - About 1 wk to fix
          web/js/CamerawebThrottle.js on lines 830..905

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

          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 resizeHeader = function() {
              $nextBlockTop = 0;
              var headerWidth = $(window).width();
              var headerHeight = $sizeCtrlPercent * $headerHeightRef;
              var header = $('#header');
          Severity: Major
          Found in web/js/CamerawebThrottle.js and 1 other location - About 1 wk to fix
          web/js/webThrottle.js on lines 811..886

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

          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

          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

          Severity
          Category
          Status
          Source
          Language