OpenC3/cosmos

View on GitHub

Showing 842 of 1,379 total issues

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

    def __init__(self):
        self.state = "DISCONNECTED"
        self.target_names = []
        self.cmd_target_names = []
        self.tlm_target_names = []
Severity: Minor
Found in openc3/python/openc3/interfaces/interface.py - About 1 hr to fix

    Method create_telemetry has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create_telemetry(xml, telemetry, target_name)
          # Gather and make unique all the packet items
          unique_items = telemetry[target_name] ? get_unique(telemetry[target_name]) : {}
    
          xml['xtce'].TelemetryMetaData do
    Severity: Minor
    Found in openc3/lib/openc3/packets/parsers/xtce_converter.rb - About 1 hr to fix

      Method start_listen_thread has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def start_listen_thread(port, listen_write = false, listen_read = false)
            # Create a socket to accept connections from clients
            addr = Socket.pack_sockaddr_in(port, @listen_address)
            if RUBY_ENGINE == 'ruby'
              listen_socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
      Severity: Minor
      Found in openc3/lib/openc3/interfaces/tcpip_server_interface.rb - About 1 hr to fix

        Method protocol_cmd has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def protocol_cmd(cmd_name, *cmd_args, read_write: :READ_WRITE, index: -1)
              read_write = read_write.to_s.upcase.intern
              raise "Unknown protocol descriptor: #{read_write}. Must be :READ, :WRITE, or :READ_WRITE." unless [:READ, :WRITE, :READ_WRITE].include?(read_write)
              handled = false
        
        
        Severity: Minor
        Found in openc3/lib/openc3/interfaces/interface.rb - About 1 hr to fix

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

              def initialize(write_port,
                             read_port,
                             write_timeout,
                             read_timeout,
                             protocol_type = nil,
          Severity: Minor
          Found in openc3/lib/openc3/interfaces/tcpip_server_interface.rb - About 1 hr to fix

            Method write_item has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def write_item(item, value, buffer)
                  item_name = item.name
                  case item_name
                  when 'HTTP_STATUS'
                    @packet.extra ||= {}
            Severity: Minor
            Found in openc3/lib/openc3/accessors/http_accessor.rb - About 1 hr to fix

              Method call has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def call(log, _appender = nil)
                    #<SemanticLogger::Log:0x0000ffffa5002b20 @level=:info, @thread_name="puma srv tp 001", @name="MicroservicesController",
                    # @time=2024-09-22 18:04:27.955490052 +0000, @tags=[], @named_tags={}, @level_index=2, @message="Completed #traefik",
                    # @payload={:controller=>"MicroservicesController", :action=>"traefik", :format=>"HTML", :method=>"GET",
                    # :path=>"/openc3-api/traefik", :status=>200, :view_runtime=>0.41, :allocations=>1438, :status_message=>"OK",
              Severity: Minor
              Found in openc3/lib/openc3/utilities/cosmos_rails_formatter.rb - About 1 hr to fix

                Method _limits_group has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def _limits_group(group_name, action:, manual:, scope:, token:)
                      authorize(permission: 'tlm_set', manual: manual, scope: scope, token: token)
                      group_name.upcase!
                      group = get_limits_groups(scope: scope, token: token)[group_name]
                      raise "LIMITS_GROUP #{group_name} undefined. Ensure your telemetry definition contains the line: LIMITS_GROUP #{group_name}" unless group
                Severity: Minor
                Found in openc3/lib/openc3/api/limits_api.rb - About 1 hr to fix

                  Method multi_create has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def multi_create
                      return unless authorization('script_run')
                      input_activities = params.to_unsafe_h.slice(:multi).to_h['multi']
                      unless input_activities.is_a?(Array)
                        render json: { status: 'error', message: 'invalid input, must be json list/array' }, status: 400
                  Severity: Minor
                  Found in openc3-cosmos-cmd-tlm-api/app/controllers/activity_controller.rb - About 1 hr to fix

                    Method file_thread_body has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def file_thread_body(objects)
                        topics, offsets, item_objects_by_topic, packet_objects_by_topic = @collection.topics_offsets_and_objects
                        results = []
                    
                        # This will read out packets until nothing is left
                    Severity: Minor
                    Found in openc3-cosmos-cmd-tlm-api/app/models/logged_streaming_thread.rb - About 1 hr to fix

                      Function patch_addPadding has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      diff_match_patch.prototype.patch_addPadding = function (patches) {
                        var paddingLength = this.Patch_Margin
                        var nullPadding = ''
                        for (var x = 1; x <= paddingLength; x++) {
                          nullPadding += String.fromCharCode(x)

                        Function getSingleDiffInfo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function getSingleDiffInfo(editor, offset, diffString) {
                          const info = {
                            startLine: 0,
                            startChar: 0,
                            endLine: 0,

                          Function diff_linesToChars_ has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          diff_match_patch.prototype.diff_linesToChars_ = function (text1, text2) {
                            var lineArray = [] // e.g. lineArray[4] == 'Hello\n'
                            var lineHash = {} // e.g. lineHash['Hello\n'] == 4
                          
                            // '\x00' is a valid character, but various debuggers don't like it.

                            Function diff_main has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            diff_match_patch.prototype.diff_main = function (
                              text1,
                              text2,
                              opt_checklines,
                              opt_deadline,

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

                                  def identify(packet_data, target_names = nil)
                                    identified_packet = nil
                              
                                    target_names = target_names() unless target_names
                              
                              
                              Severity: Minor
                              Found in openc3/lib/openc3/packets/commands.rb - About 1 hr to fix

                                Method get_tlm_values has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def self.get_tlm_values(items, stale_time: 30, cache_timeout: nil, scope: $openc3_scope)
                                      now = Time.now
                                      results = []
                                      lookups = []
                                      packet_lookup = {}
                                Severity: Minor
                                Found in openc3/lib/openc3/models/cvt_model.rb - About 1 hr to fix

                                  Method finish_packet has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def finish_packet
                                        if @current_packet
                                          warnings = @current_packet.check_bit_offsets
                                          if warnings.length > 0
                                            raise "Overlapping items not allowed in tables.\n#{warnings}"
                                  Severity: Minor
                                  Found in openc3/lib/openc3/tools/table_manager/table_config.rb - About 1 hr to fix

                                    Method qfromc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def self.qfromc(rotation_matrix)
                                          tracec = rotation_matrix.trace()
                                          p = 1.0 + tracec
                                          if p < 0.0
                                            p = 0.0
                                    Severity: Minor
                                    Found in openc3/lib/openc3/utilities/quaternion.rb - About 1 hr to fix

                                      Method _build_cmd_output_string has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          def _build_cmd_output_string(method_name, target_name, cmd_name, cmd_params, packet)
                                            output_string = "#{method_name}(\""
                                            output_string << (target_name + ' ' + cmd_name)
                                            if cmd_params.nil? or cmd_params.empty?
                                              output_string << '")'
                                      Severity: Minor
                                      Found in openc3/lib/openc3/api/cmd_api.rb - About 1 hr to fix

                                        Method calc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                              def calc(data, seed = @seed)
                                                crc = seed
                                        
                                                case @bit_size
                                                when 8
                                        Severity: Minor
                                        Found in openc3/lib/openc3/utilities/crc.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language