OpenC3/cosmos

View on GitHub

Showing 842 of 1,379 total issues

Method read_item has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def read_item(item, buffer)
      item_name = item.name
      case item_name
      when 'HTTP_STATUS'
        return nil unless @packet.extra
Severity: Minor
Found in openc3/lib/openc3/accessors/http_accessor.rb - About 1 hr to fix

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

      def initialize
        # Create local file cache location
        @cache_dir = Dir.mktmpdir
        FileUtils.mkdir_p(@cache_dir)
        at_exit do
    Severity: Minor
    Found in openc3/lib/openc3/utilities/bucket_file_cache.rb - About 1 hr to fix

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

        def initialize(key, start_time_nsec, end_time_nsec, item_key: nil, scope:, token: nil)
          key = key.upcase
          @key = key
          @item_key = item_key
          key_split = key.split('__')
      Severity: Minor
      Found in openc3-cosmos-cmd-tlm-api/app/models/streaming_object.rb - About 1 hr to fix

        Function addEventHandlers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function addEventHandlers(acediff) {
          acediff.editors.left.ace.getSession().on(
            'changeScrollTop',
            throttle(() => {
              updateGap(acediff)

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

              def read
                packet = nil
                if @connected
                  while true
                    packet = first_pending_packet()
          Severity: Minor
          Found in openc3/lib/openc3/interfaces/simulated_target_interface.rb - About 1 hr to fix

            Method connect has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def connect
                  # Packet definitions need to be retrieved here because @target_names is not filled in until after initialize
                  unless @handshake_enableds
                    @handshake_enableds = {}
                    @target_names.each do |target_name|
            Severity: Minor
            Found in openc3/lib/openc3/interfaces/linc_interface.rb - About 1 hr to fix

              Method report has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.report(binary, definition_filename, requested_table_name = nil)
                    report = StringIO.new
                    config = TableConfig.process_file(definition_filename)
                    begin
                      load_binary(config, binary)
              Severity: Minor
              Found in openc3/lib/openc3/tools/table_manager/table_manager_core.rb - About 1 hr to fix

                Function exec has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async exec(method, params, kwparams = {}, headerOptions = {}) {
                    try {
                      let refreshed = await OpenC3Auth.updateToken(
                        OpenC3Auth.defaultMinValidity,
                      )
                Severity: Minor
                Found in openc3/templates/tool_svelte/src/services/openc3-api.js - About 1 hr to fix

                  Method to_config has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def to_config(output_dir)
                        FileUtils.mkdir_p(output_dir)
                  
                        @telemetry.each do |target_name, packets|
                          next if target_name == 'UNKNOWN'
                  Severity: Minor
                  Found in openc3/lib/openc3/packets/packet_config.rb - About 1 hr to fix

                    Method undeploy has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def undeploy
                          prefix = "#{@scope}/targets/#{@name}/"
                          @bucket.list_objects(bucket: ENV['OPENC3_CONFIG_BUCKET'], prefix: prefix).each do |object|
                            @bucket.delete_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: object.key)
                          end
                    Severity: Minor
                    Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

                      Method cycle_thread_body has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def cycle_thread_body
                            @@cycle_sleeper = Sleeper.new
                            while true
                              start_time = Time.now
                              @@mutex.synchronize do
                      Severity: Minor
                      Found in openc3/lib/openc3/logs/log_writer.rb - About 1 hr to fix

                        Method set_limits has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def set_limits(target_name, packet_name, item_name, red_low, yellow_low, yellow_high, red_high,
                                           green_low = nil, green_high = nil, limits_set = 'CUSTOM', persistence = nil, enabled = true,
                                           manual: false, scope: $openc3_scope, token: $openc3_token)
                              authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
                              if (red_low > yellow_low) || (yellow_low >= yellow_high) || (yellow_high > red_high)
                        Severity: Minor
                        Found in openc3/lib/openc3/api/limits_api.rb - About 1 hr to fix

                          Method analyze_local_mode has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def self.analyze_local_mode(plugin_name:, scope:)
                                if ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
                                  # We already know a plugin with this name doesn't exist in the models
                                  # Now need to determine if there is a highly likely candidate that has been
                                  # updated, so that we don't do an erroneous extra plugin install
                          Severity: Minor
                          Found in openc3/lib/openc3/utilities/local_mode.rb - About 1 hr to fix

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

                              def initialize(id, scope, name, disconnect)
                                @@instance = self
                                @id = id
                                @@id = id
                                @scope = scope
                            Severity: Minor
                            Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 1 hr to fix

                              Method redis_thread_body has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def redis_thread_body
                                  topics, offsets, item_objects_by_topic, packet_objects_by_topic = @collection.topics_offsets_and_objects
                                  results = []
                                  if topics.length > 0
                                    # 500ms timeout to allow for thread to shutdown within 1 second
                              Severity: Minor
                              Found in openc3-cosmos-cmd-tlm-api/app/models/streaming_thread.rb - About 1 hr to fix

                                Method generate_target has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def self.generate_target(args)
                                      if args.length < 2 or args.length > 3
                                        abort("Usage: cli generate #{args[0]} <NAME> (--ruby or --python)")
                                      end
                                
                                
                                Severity: Minor
                                Found in openc3/lib/openc3/utilities/cli_generator.rb - About 1 hr to fix

                                  Method check_tolerance has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def check_tolerance(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
                                        raise "Invalid type '#{type}' for check_tolerance" unless %i(RAW CONVERTED).include?(type)
                                  
                                        target_name, packet_name, item_name, expected_value, tolerance =
                                          _check_tolerance_process_args(args)
                                  Severity: Minor
                                  Found in openc3/lib/openc3/script/api_shared.rb - About 1 hr to fix

                                    Method handle_output_io has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def handle_output_io(filename = @current_filename, line_number = @current_line_number)
                                        @output_time = Time.now.sys
                                        if @output_io.string[-1..-1] == "\n"
                                          time_formatted = Time.now.sys.formatted
                                          color = 'BLACK'
                                    Severity: Minor
                                    Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 1 hr to fix

                                      Function digit16 has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      diff_match_patch.prototype.digit16 = function (c) {
                                        switch (c) {
                                          case '0':
                                            return 0
                                          case '1':

                                        Method handle_packet has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            def handle_packet(packet)
                                              InterfaceStatusModel.set(@interface.as_json(:allow_nan => true), queued: true, scope: @scope)
                                              packet.received_time = Time.now.sys unless packet.received_time
                                        
                                              if packet.stored
                                        Severity: Minor
                                        Found in openc3/lib/openc3/microservices/interface_microservice.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language