jython/DispatcherSystem/ResetButtonMaster.py

Summary

Maintainability
F
3 wks
Test Coverage

File ResetButtonMaster.py has 1379 lines of code (exceeds 300 allowed). Consider refactoring.
Open

from javax.swing import JTable, JScrollPane, JFrame, JPanel, JComboBox,  BorderFactory, DefaultCellEditor, JLabel, UIManager, SwingConstants, JFileChooser
from javax.swing.table import  TableCellRenderer, DefaultTableCellRenderer
from java.awt.event import MouseAdapter,MouseEvent, WindowListener, WindowEvent
from java.awt import GridLayout, Dimension, BorderLayout, Color
from javax.swing.table import AbstractTableModel, DefaultTableModel
Severity: Major
Found in jython/DispatcherSystem/ResetButtonMaster.py - About 3 days to fix

    Function process_sensors_requiring_use_of_station_buttons has a Cognitive Complexity of 113 (exceeds 20 allowed). Consider refactoring.
    Open

        def  process_sensors_requiring_use_of_station_buttons(self, sensor_changed):
    
            # all these sensors when active require the use of station buttons. Only one of these can be active at any one
            # time, hence the grouping of these in a routine and the grouping of the buttons on the panel
    
    
    Severity: Minor
    Found in jython/DispatcherSystem/ResetButtonMaster.py - About 1 day 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 handle has a Cognitive Complexity of 88 (exceeds 20 allowed). Consider refactoring.
    Open

        def handle(self):
    
            # trains is a dictionary, with keys of the train_name
            # each value is itself a dictionary with 3 items
            # edge
    Severity: Minor
    Found in jython/DispatcherSystem/ResetButtonMaster.py - About 1 day 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

    ResetButtonMaster has 53 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ResetButtonMaster(jmri.jmrit.automat.AbstractAutomaton):
    
        # monitors station buttons and
        # monitors sensors_requiring_use_of_station_buttons
        # "setDispatchSensor", "setRouteSensor", "setStoppingDistanceSensor",
    Severity: Major
    Found in jython/DispatcherSystem/ResetButtonMaster.py - About 7 hrs to fix

      createandshowGUI2 has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class createandshowGUI2(TableModelListener):
      
          def __init__(self, class_ResetButtonMaster):
              self.logLevel = 0
              self.class_ResetButtonMaster = class_ResetButtonMaster
      Severity: Minor
      Found in jython/DispatcherSystem/ResetButtonMaster.py - About 2 hrs to fix

        Function handle has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
        Open

            def handle(self):
                if self.logLevel > 1: print "in resetbuttonmaster", [ str(sensor.getUserName()) for sensor in self.button_sensors_to_watch if sensor in self.sensors_requiring_use_of_station_buttons]
                global setAllStoppingSensors
                global stopping_sensor_choice
                #wait for a sensor to go active
        Severity: Minor
        Found in jython/DispatcherSystem/ResetButtonMaster.py - About 1 hr 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 completeTablePanel has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def completeTablePanel(self):
        
                self.topPanel= JPanel();
                self.topPanel.setLayout(BoxLayout(self.topPanel, BoxLayout.X_AXIS))
                self.self_table()
        Severity: Minor
        Found in jython/DispatcherSystem/ResetButtonMaster.py - About 1 hr to fix

          Function self_table has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self_table(self):
          
                  #table.setPreferredScrollableViewportSize(Dimension(500, 70));
                  #table.setFillsViewportHeight(True)
                  #self.table.getModel().addtableModelListener(self)
          Severity: Minor
          Found in jython/DispatcherSystem/ResetButtonMaster.py - About 1 hr to fix

            Function run_route has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
            Open

                def run_route(self):
                    global trains_dispatched
                    # list_items = ("Run Route", "Cancel")
                    # title = "choose option"
                    # result = self.od.List(title, list_items)
            Severity: Minor
            Found in jython/DispatcherSystem/ResetButtonMaster.py - About 55 mins 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

            Avoid deeply nested control flow statements.
            Open

                                            if self.logLevel > 0: print "current_block", current_block,"block_occupancy", block_occupancy,
                                            self.set_mem_variable(current_block,train_name,block_occupancy)
            Severity: Major
            Found in jython/DispatcherSystem/ResetButtonMaster.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if self.logLevel > 0: print "current_block", current_block,"block_occupancy", block_occupancy,
                                              self.set_mem_variable(current_block,train_name,block_occupancy)
              Severity: Major
              Found in jython/DispatcherSystem/ResetButtonMaster.py - About 45 mins to fix

                Function getTableCellRendererComponent has 6 arguments (exceeds 5 allowed). Consider refactoring.
                Open

                    def getTableCellRendererComponent(self, jtable, value, isSelected, hasFocus, row, column) :
                Severity: Minor
                Found in jython/DispatcherSystem/ResetButtonMaster.py - About 35 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return
                  Severity: Major
                  Found in jython/DispatcherSystem/ResetButtonMaster.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return
                    Severity: Major
                    Found in jython/DispatcherSystem/ResetButtonMaster.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                                  return
                      Severity: Major
                      Found in jython/DispatcherSystem/ResetButtonMaster.py - About 30 mins to fix

                        Function loadfromfile_action has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                        Open

                            def loadfromfile_action(self, event):
                                # load the file
                                dir = self.directory()
                                j = JFileChooser(dir);
                                j.setAcceptAllFileFilterUsed(False)
                        Severity: Minor
                        Found in jython/DispatcherSystem/ResetButtonMaster.py - About 25 mins 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

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

                            def buttonPanel(self):
                                row1_1_button = JButton("Add Row", actionPerformed = self.add_row_action)
                                row1_2_button = JButton("Save", actionPerformed = self.save_action)
                        
                                row1 = JPanel()
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 day to fix
                        jython/DispatcherSystem/StopDispatcherSystem.py on lines 89..112

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

                        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

                            def get_filename(self, e, suffix):
                        
                                # suffix is "fwd" or "rvs"
                                # e is edge
                        
                        
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 2 other locations - About 1 day to fix
                        jython/DispatcherSystem/CreateTransits.py on lines 1028..1045
                        jython/DispatcherSystem/RunDispatch.py on lines 1911..1925

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

                        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

                            def get_position_of_train(self, train_to_move):
                                ## Check the pressed button
                                for station_block_name in g.station_block_list:
                                    if self.logLevel > 0: print "station_block_name", station_block_name
                        
                        
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 day to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1065..1086

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

                        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

                            def get_position_of_train(self, train_to_move):
                                ## Check the pressed button
                                for station_block_name in g.station_block_list:
                                    if self.logLevel > 0: print "station_block_name", station_block_name
                        
                        
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 day to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1929..1950

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

                        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

                            def task_action(self, event):
                                [train_col, route_col, run_route_col, task_col, delay_col, repetition_col] = [0, 1, 2, 3, 4, 5]
                                for row in reversed(range(len(self.model.data))):
                                    old_val = str(self.model.data[0][task_col])
                                    if old_val == None: old_val = 0
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 2 other locations - About 7 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1428..1435
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1449..1456

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

                        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

                            def delay_action(self, event):
                                [train_col, route_col, run_route_col, task_col, delay_col, repetition_col] = [0, 1, 2, 3, 4, 5]
                                for row in reversed(range(len(self.model.data))):
                                    old_delay = int(self.model.data[0][delay_col])
                                    if old_delay == None: old_delay = 0
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 2 other locations - About 7 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1449..1456
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1470..1477

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

                        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

                            def repetitions_action(self, event):
                                [train_col, route_col, run_route_col, task_col, delay_col, repetition_col] = [0, 1, 2, 3, 4, 5]
                                for row in reversed(range(len(self.model.data))):
                                    old_val = int(self.model.data[0][repetition_col])
                                    if old_val == None: old_val = 0
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 2 other locations - About 7 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1428..1435
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1470..1477

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

                        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

                        class ComboBoxCellRenderer1 (TableCellRenderer):
                        
                            def getTableCellRendererComponent(self, jtable, value, isSelected, hasFocus, row, column) :
                                panel = self.createPanel(value)
                                return panel
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 7 hrs to fix
                        jython/DispatcherSystem/StopDispatcherSystem.py on lines 336..348

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

                        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

                            def get_all_roster_entries_with_speed_profile(self):
                                roster_entries_with_speed_profile = []
                                r = jmri.jmrit.roster.Roster.getDefault()
                                for roster_entry in jmri.jmrit.roster.Roster.getAllEntries(r):
                                    if self.logLevel > 0: print "roster_entry.getSpeedProfile()",roster_entry,roster_entry.getSpeedProfile()
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 6 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1891..1899

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

                        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

                            def get_all_roster_entries_with_speed_profile(self):
                                roster_entries_with_speed_profile = []
                                r = jmri.jmrit.roster.Roster.getDefault()
                                for roster_entry in jmri.jmrit.roster.Roster.getAllEntries(r):
                                    if self.logLevel > 0: print "roster_entry.getSpeedProfile()",roster_entry,roster_entry.getSpeedProfile()
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 6 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1110..1118

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

                        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 8 locations. Consider refactoring.
                        Open

                            def directory(self):
                                path = jmri.util.FileUtil.getUserFilesPath() + "dispatcher" + java.io.File.separator + "routes"
                                if not os.path.exists(path):
                                    os.makedirs(path)
                                return path + java.io.File.separator
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 7 other locations - About 4 hrs to fix
                        jython/DispatcherSystem/CreateIcons.py on lines 820..824
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 699..703
                        jython/DispatcherSystem/RunDispatch.py on lines 983..987
                        jython/DispatcherSystem/RunDispatch.py on lines 988..992
                        jython/DispatcherSystem/RunDispatch.py on lines 2190..2194
                        jython/DispatcherSystem/Scheduler.py on lines 538..542
                        jython/DispatcherSystem/Scheduler.py on lines 544..548

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

                        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 8 locations. Consider refactoring.
                        Open

                            def directory(self):
                                path = jmri.util.FileUtil.getUserFilesPath() + "dispatcher" + java.io.File.separator + "blockDirections"
                                if not os.path.exists(path):
                                    os.makedirs(path)
                                return path + java.io.File.separator
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 7 other locations - About 4 hrs to fix
                        jython/DispatcherSystem/CreateIcons.py on lines 820..824
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1560..1564
                        jython/DispatcherSystem/RunDispatch.py on lines 983..987
                        jython/DispatcherSystem/RunDispatch.py on lines 988..992
                        jython/DispatcherSystem/RunDispatch.py on lines 2190..2194
                        jython/DispatcherSystem/Scheduler.py on lines 538..542
                        jython/DispatcherSystem/Scheduler.py on lines 544..548

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

                        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 3 locations. Consider refactoring.
                        Open

                            def check_sensor_state_given_block_name(self, station_block_name):
                                #if self.logLevel > 0: print("station block name {}".format(station_block_name))
                                layoutBlock = layoutblocks.getLayoutBlock(station_block_name)
                                station_sensor = layoutBlock.getOccupancySensor()
                                if station_sensor is None:
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 2 other locations - About 3 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1952..1960
                        jython/DispatcherSystem/RunDispatch.py on lines 2134..2142

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

                        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 3 locations. Consider refactoring.
                        Open

                            def check_sensor_state_given_block_name(self, station_block_name):
                                #if self.logLevel > 0: print("station block name {}".format(station_block_name))
                                layoutBlock = layoutblocks.getLayoutBlock(station_block_name)
                                station_sensor = layoutBlock.getOccupancySensor()
                                if station_sensor is None:
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 2 other locations - About 3 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1100..1108
                        jython/DispatcherSystem/RunDispatch.py on lines 2134..2142

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

                        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 new_val(self, old_val):
                                if old_val < 3:
                                    new_val = 3
                                elif old_val < 10:
                                    new_val = 10
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 3 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1436..1447

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

                        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 new_delay(self, old_val):
                                if old_val < 3:
                                    new_val = 3
                                elif old_val < 5:
                                    new_val = 5
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 3 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1457..1468

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

                        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

                            def check_sensor_state(self, sensor):
                                #if self.logLevel > 0: print("check_sensor_state",sensor)
                                if sensor == None :
                                    #if self.logLevel > 0: print('Sensor in check_sensor_state is none')
                                    return None
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 3 hrs to fix
                        jython/DispatcherSystem/RunDispatch.py on lines 2162..2173

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

                        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

                                if option == "stop at end of route":
                                    station_to = None
                                    repeat = False
                                elif option == "return to start position":
                                    station_to = station_from
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1003..1013

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

                        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

                                if option == "stop at end of route":
                                    station_to = None
                                    repeat = False
                                elif option == "return to start position":
                                    station_to = station_from
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1529..1539

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

                        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

                                    elif s == opt2:
                                        #stopping_sensor_choice = "Set At particular station
                                        msg = "Press station buttons to select a section in order to\nset one way working at that station\n"
                                        msg = msg + "secect the second station adjacent to the first to indicate the direction"
                                        self.od.displayMessage(msg)
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 429..437

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

                        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

                                    elif s == opt2:
                                        #stopping_sensor_choice = "Set At particular station
                                        msg = "Press station buttons to select a section in order to\nset stop sensor at a station\n"
                                        msg = msg + "secect the second station adjacent to the first to indicate the station where you are stopping"
                                        self.od.displayMessage(msg)
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 343..351

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

                        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

                                        msg = "new stopping position: " + str(round(float(sp),1)) + " cm (" + \
                                              str(round(float(new_stopping_position)/2.54,1)) + " inches) after calculated position"
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 835..837

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

                        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

                                    for row in reversed(range(len(self.model.data))):
                                        if self.model.data[row][train_col] not in trains_to_put_in_dropdown:
                                            self.model.data.pop(row)
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1420..1422

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

                        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

                                    if float(new_stopping_position) > 0:
                                        msg = "new stopping position: " + str(round(float(new_stopping_position),1)) + " cm (" + \
                                              str(round(float(new_stopping_position)/2.54,1)) + " inches) before calculated position."
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 840..841

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

                        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

                                    for row in reversed(range(len(self.model.data))):
                                        if self.model.data[row][route_col] not in routes:
                                            self.model.data.pop(row)
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 1414..1416

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

                        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 modify_station_wait_time(self, found_edge, new_stopping_fraction, filename):
                                trainInfo = jmri.jmrit.dispatcher.TrainInfoFile().readTrainInfo(filename)
                                #stopping_fraction = trainInfo_rvs.getStopBySpeedProfileAdjust()
                                trainInfo.setWaitTime(float(new_stopping_fraction))
                        
                        
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 799..805

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

                        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 modify_stopping_distance(self, found_edge, new_stopping_fraction, filename):
                                trainInfo = jmri.jmrit.dispatcher.TrainInfoFile().readTrainInfo(filename)
                                #stopping_fraction = trainInfo_rvs.getStopBySpeedProfileAdjust()
                                trainInfo.setStopBySpeedProfileAdjust(float(new_stopping_fraction))
                        
                        
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 2 hrs to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 807..813

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

                        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

                                if trains_dispatched != []:
                                    for train in trains_dispatched:
                                        if self.logLevel > 0: print "removing" ,train
                                        trains_to_choose.remove(train)
                                        if self.logLevel > 0: print "trains_to_choose",trains_to_choose
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 hr to fix
                        jython/DispatcherSystem/RunDispatch.py on lines 1981..1985

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

                        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

                                for row in reversed(range(len(self.data))):
                                    # print "row", row
                                    if self.data[row][1] == "":
                                        self.data.pop(row)
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 hr to fix
                        jython/DispatcherSystem/StopDispatcherSystem.py on lines 360..363

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

                        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

                            def get_buttons(self):
                                self.button_sensors = [self.get_button_sensor_given_block_name(station_block_name) for station_block_name in g.station_block_list]
                                self.button_sensor_states = [self.check_sensor_state(button_sensor) for button_sensor in self.button_sensors]
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 hr to fix
                        jython/DispatcherSystem/RunDispatch.py on lines 2155..2157

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

                        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

                                    list_items = [ " transit '" + l[0] + "' waits for block '" + l[1] + "' to be clear " for l in list_items1]
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 hr to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 537..537

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

                        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

                                list_items = [ "transit " + l[0] + " waits for block " + l[1] + " to be clear" for l in list_items1]
                        Severity: Major
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 1 hr to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 450..450

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

                        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

                                list_items = [ "from " + l[1] + " to " + l[0] for l in list_items1]
                        Severity: Minor
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 45 mins to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 329..329

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

                        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

                                    list_items = [ "from " + l[1] + " to " + l[0] for l in list_items1]
                        Severity: Minor
                        Found in jython/DispatcherSystem/ResetButtonMaster.py and 1 other location - About 45 mins to fix
                        jython/DispatcherSystem/ResetButtonMaster.py on lines 497..497

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

                        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

                        There are no issues that match your filters.

                        Category
                        Status