OpenC3/cosmos

View on GitHub

Showing 842 of 1,379 total issues

Method write_entry has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def write_entry(state, plw, type, target_name, packet_name, stored)
      return unless state.reduced.length > 0
      reduce(type, state.raw_keys, state.converted_keys, state.reduced)
      state.reduced.merge!(state.entry_samples)
      time = state.entry_time
Severity: Minor
Found in openc3/lib/openc3/microservices/reducer_microservice.rb - About 1 hr to fix

    Method to_hash has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def to_hash
          hash = super()
          hash['format_string'] = self.format_string
          if self.read_conversion
            hash['read_conversion'] = self.read_conversion.to_s
    Severity: Minor
    Found in openc3/lib/openc3/packets/packet_item.rb - About 1 hr to fix

      Method get_target_file has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def get_target_file(path, original: false, scope: $openc3_scope)
            part = "targets"
            part += "_modified" unless original
            # Loop to allow redo when switching from modified to original
            loop do
      Severity: Minor
      Found in openc3/lib/openc3/script/storage.rb - About 1 hr to fix

        Method setup_targets has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.setup_targets(target_names, base_dir, scope:)
              # Nothing to do if there are no targets
              return if target_names.nil? or target_names.length == 0
              if @@instance.nil?
                FileUtils.mkdir_p("#{base_dir}/targets")
        Severity: Minor
        Found in openc3/lib/openc3/system/system.rb - About 1 hr to fix

          Method handle_build_cmd has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def handle_build_cmd(build_cmd_json, msg_id)
                build_cmd_hash = JSON.parse(build_cmd_json, allow_nan: true, create_additions: true)
                target_name = build_cmd_hash['target_name']
                cmd_name = build_cmd_hash['cmd_name']
                cmd_params = build_cmd_hash['cmd_params']
          Severity: Minor
          Found in openc3/lib/openc3/microservices/interface_decom_common.rb - About 1 hr to fix

            Method _cmd has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def _cmd(cmd, cmd_no_hazardous, *args, timeout: nil, log_message: nil, validate: true, scope: $openc3_scope, token: $openc3_token, **kwargs)
                  extract_string_kwargs_to_args(args, kwargs)
                  raw = cmd.include?('raw')
                  no_range = cmd.include?('no_range') || cmd.include?('no_checks')
                  no_hazardous = cmd.include?('no_hazardous') || cmd.include?('no_checks')
            Severity: Minor
            Found in openc3/lib/openc3/script/commands.rb - About 1 hr to fix

              Method convert_data_to_packet has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def convert_data_to_packet(data, extra = nil)
                    packet = Packet.new(nil, nil, :BIG_ENDIAN, nil, data.to_s)
                    packet.accessor = HttpAccessor.new(packet)
                    if extra
                      # Identify the response
              Severity: Minor
              Found in openc3/lib/openc3/interfaces/http_client_interface.rb - About 1 hr to fix

                Method update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def update(start:, stop:, kind:, data:, overlap: true)
                      array = Store.zrangebyscore(@primary_key, @start, @start)
                      if array.length == 0
                        raise ActivityError.new "failed to find activity at: #{@start}"
                      end
                Severity: Minor
                Found in openc3/lib/openc3/models/activity_model.rb - About 1 hr to fix

                  Method move_log_file_to_bucket has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.move_log_file_to_bucket(filename, bucket_key, metadata: {})
                        Thread.new do
                          client = Bucket.getClient()
                  
                          orig_filename = nil
                  Severity: Minor
                  Found in openc3/lib/openc3/utilities/bucket_utilities.rb - About 1 hr to fix

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

                        def read
                          raise "Attempt to read from write only stream" unless @read_socket
                    
                          # No read mutex is needed because reads happen serially
                          begin
                    Severity: Minor
                    Found in openc3/lib/openc3/streams/tcpip_socket_stream.rb - About 1 hr to fix

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

                        def initialize(bucket_path)
                          @bucket = OpenC3::Bucket.getClient()
                          @bucket_path = bucket_path
                          @local_path = nil
                          @reservation_count = 0
                      Severity: Minor
                      Found in openc3/lib/openc3/utilities/bucket_file_cache.rb - About 1 hr to fix

                        Method create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def create
                            return unless authorization('script_run')
                            if params['key'].nil? || params['value'].nil?
                              render json: {
                                status: 'error',
                        Severity: Minor
                        Found in openc3-cosmos-cmd-tlm-api/app/controllers/environment_controller.rb - About 1 hr to fix

                          Function addCopyArrows has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function addCopyArrows(acediff, info, diffIndex) {
                            if (
                              info.leftEndLine > info.leftStartLine &&
                              acediff.options.left.copyLinkEnabled
                            ) {

                            Function __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def __init__(
                                    self,
                                    name: str,
                                    folder_name: str = None,
                                    cmd: Optional[list] = None,
                            Severity: Minor
                            Found in openc3/python/openc3/models/microservice_model.py - About 1 hr to fix

                              Method cleanup has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def cleanup(areas, cleanup_poll_time)
                                    bucket = Bucket.getClient()
                                    while true
                                      break if @cancel_thread
                              
                              
                              Severity: Minor
                              Found in openc3/lib/openc3/microservices/cleanup_microservice.rb - About 1 hr to fix

                                Method update_min_stats has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      def update_min_stats(reduced, state)
                                        # Update statistics for this packet's raw values
                                        state.raw_values.each do |key, value|
                                          if value
                                            vals_key = "#{key}__VALS"
                                Severity: Minor
                                Found in openc3/lib/openc3/microservices/reducer_microservice.rb - About 1 hr to fix

                                  Method values_and_limits_states has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        def values_and_limits_states(item_array, value_types = :CONVERTED)
                                          items = []
                                  
                                          # Verify item_array is a nested array
                                          raise(ArgumentError, "item_array must be a nested array consisting of [[tgt,pkt,item],[tgt,pkt,item],...]") unless Array === item_array[0]
                                  Severity: Minor
                                  Found in openc3/lib/openc3/packets/telemetry.rb - About 1 hr to fix

                                    Method download has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def self.download(target_name, scope:)
                                          tmp_dir = Dir.mktmpdir
                                          zip_filename = File.join(tmp_dir, "#{target_name}.zip")
                                          Zip.continue_on_exists_proc = true
                                          zip = Zip::File.open(zip_filename, Zip::File::CREATE)
                                    Severity: Minor
                                    Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

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

                                          def connect
                                            (@read_protocols | @write_protocols).each { |protocol| protocol.connect_reset }
                                      
                                            periodic_cmds = @options['PERIODIC_CMD']
                                            if periodic_cmds
                                      Severity: Minor
                                      Found in openc3/lib/openc3/interfaces/interface.rb - About 1 hr to fix

                                        Method identify has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            def identify(packet_data, target_names = nil)
                                              target_names = target_names() unless target_names
                                        
                                              target_names.each do |target_name|
                                                target_name = target_name.to_s.upcase
                                        Severity: Minor
                                        Found in openc3/lib/openc3/packets/telemetry.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language