OpenC3/cosmos

View on GitHub

Showing 842 of 1,379 total issues

Method start_service has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start_service(hostname = nil, port = nil, object = nil, max_threads = 1000)
      server_started = false
      @server_mutex.synchronize do
        server_started = true if @server
      end
Severity: Major
Found in openc3/lib/openc3/io/json_drb.rb - About 2 hrs to fix

    Method from_json has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.from_json(hash)
          # Convert strings to symbols
          endianness = hash['endianness'] ? hash['endianness'].intern : nil
          data_type = hash['data_type'] ? hash['data_type'].intern : nil
          overflow = hash['overflow'] ? hash['overflow'].intern : nil
    Severity: Major
    Found in openc3/lib/openc3/packets/packet_item.rb - About 2 hrs to fix

      Method monitor has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def monitor
            processes_to_delete = []
            cleanup_time = Time.now
            while true
              current_time = Time.now
      Severity: Major
      Found in openc3/lib/openc3/utilities/process_manager.rb - About 2 hrs to fix

        Method install_phase1 has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.install_phase1(gem_file_path, existing_variables: nil, existing_plugin_txt_lines: nil, process_existing: false, scope:, validate_only: false)
              gem_name = File.basename(gem_file_path).split("__")[0]
        
              temp_dir = Dir.mktmpdir
              tf = nil
        Severity: Major
        Found in openc3/lib/openc3/models/plugin_model.rb - About 2 hrs to fix

          Method set_min_max_default has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def set_min_max_default(item, type, data_type)
                return unless @current_cmd_or_tlm == PacketConfig::COMMAND
          
                # Need to set min, max, and default
                if data_type == :INT || data_type == :UINT
          Severity: Major
          Found in openc3/lib/openc3/packets/parsers/xtce_parser.rb - About 2 hrs to fix

            Method reduce_to_single_packet has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def reduce_to_single_packet
                  # Discard sync pattern if present
                  if @sync_pattern
                    if @reduction_state == :START
                      return :STOP if @data.length < @sync_pattern.length
            Severity: Major
            Found in openc3/lib/openc3/interfaces/protocols/preidentified_protocol.rb - About 2 hrs to fix

              Method instrumented has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.instrumented(filename, text)
                  language = detect_language(text, filename)
                  if language == 'ruby'
                    return {
                      'title' => 'Instrumented Script',
              Severity: Major
              Found in openc3-cosmos-script-runner-api/app/models/script.rb - About 2 hrs to fix

                Function simplifyDiffs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function simplifyDiffs(acediff, diffs) {
                  const groupedDiffs = []
                
                  function compare(val) {
                    return acediff.options.diffGranularity === C.DIFF_GRANULARITY_SPECIFIC

                  Method as_json has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def as_json(*a)
                        config = {}
                        config['target_name'] = @target_name.to_s
                        config['packet_name'] = @packet_name.to_s
                        config['endianness'] = @default_endianness.to_s
                  Severity: Major
                  Found in openc3/lib/openc3/packets/packet.rb - About 2 hrs to fix

                    Method get_check_overflow_ranges has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def self.get_check_overflow_ranges(bit_size, data_type)
                            min_value = 0 # Default for UINT cases
                    
                            case bit_size
                            when 8
                    Severity: Major
                    Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 2 hrs to fix

                      Method initialize has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def initialize(port_name = 'COM1',
                                         baud_rate = 9600,
                                         parity = :NONE,
                                         stop_bits = 1,
                                         write_timeout = 10.0,
                      Severity: Major
                      Found in openc3/lib/openc3/io/win32_serial_driver.rb - About 2 hrs to fix

                        Method update_local_plugin has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def self.update_local_plugin(plugin_file_path, plugin_hash, old_plugin_name: nil, scope:)
                              if ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
                                variables = plugin_hash['variables']
                                if variables
                                  PluginModel::RESERVED_VARIABLE_NAMES.each do |name|
                        Severity: Major
                        Found in openc3/lib/openc3/utilities/local_mode.rb - About 2 hrs to fix

                          Function diff_lineMode_ has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          diff_match_patch.prototype.diff_lineMode_ = function (text1, text2, deadline) {
                            // Scan the text on a line-by-line basis first.
                            var a = this.diff_linesToChars_(text1, text2)
                            text1 = a.chars1
                            text2 = a.chars2

                            Method deploy has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def deploy(gem_path, variables, validate_only: false)
                                  variables["target_name"] = @name
                                  start_path = "/targets/#{@folder_name}/"
                                  temp_dir = Dir.mktmpdir
                                  found = false
                            Severity: Major
                            Found in openc3/lib/openc3/models/target_model.rb - About 2 hrs to fix

                              Method extract_fields_from_cmd_text has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def extract_fields_from_cmd_text(text, scope: $openc3_scope)
                                    split_string = text.split(/\s+with\s+/i, 2)
                                    raise "ERROR: text must not be empty" if split_string.length == 0
                                    raise "ERROR: 'with' must be followed by parameters : #{text}" if (split_string.length == 1 and text =~ /\s*with\s*/i) or (split_string.length == 2 and split_string[1].empty?)
                              
                              
                              Severity: Minor
                              Found in openc3/lib/openc3/script/extract.rb - About 2 hrs to fix

                                Method process_file has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def process_file(filename, targets_config_dir)
                                      parser = ConfigParser.new("https://docs.openc3.com/docs")
                                
                                      # First pass - Everything except targets
                                      parser.parse_file(filename) do |keyword, parameters|
                                Severity: Minor
                                Found in openc3/lib/openc3/system/system_config.rb - About 2 hrs to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if "expect" in line and ".to eql" in line:
                                              line = line.replace("expect(", "self.assertEqual(")
                                              line = re.sub(r"\)\.to eql(.*)", r", \1)", line)
                                          elif "expect" in line and ".to eq" in line:
                                              line = line.replace("expect(", "self.assertEqual(")
                                  Severity: Critical
                                  Found in openc3/python/ruby_to_python.py - About 2 hrs to fix

                                    Method read has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def read
                                          raise "Interface not connected for read: #{@name}" unless connected?
                                          raise "Interface not readable: #{@name}" unless read_allowed?
                                    
                                          first = true
                                    Severity: Minor
                                    Found in openc3/lib/openc3/interfaces/interface.rb - About 2 hrs to fix

                                      Method initialize has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          def initialize(write_port_name,
                                                         read_port_name,
                                                         baud_rate,
                                                         parity,
                                                         stop_bits,
                                      Severity: Minor
                                      Found in openc3/lib/openc3/streams/serial_stream.rb - About 2 hrs to fix

                                        Method evaluate_trigger has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            def evaluate_trigger(head:, trigger:, visited:, triggers:)
                                              if visited["#{trigger.name}__R"]
                                                return visited["#{trigger.name}__R"]
                                              end
                                              if visited["#{trigger.name}__P"].nil?
                                        Severity: Minor
                                        Found in openc3/lib/openc3/microservices/trigger_group_microservice.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language