OpenC3/cosmos

View on GitHub

Showing 842 of 1,379 total issues

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

    def self.from_json(hash)
      endianness = hash['endianness'] ? hash['endianness'].intern : nil # Convert to symbol
      packet = Packet.new(hash['target_name'], hash['packet_name'], endianness, hash['description'])
      packet.short_buffer_allowed = hash['short_buffer_allowed']
      packet.hazardous = hash['hazardous']
Severity: Minor
Found in openc3/lib/openc3/packets/packet.rb - About 1 hr to fix

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

        def handle_packet(packet)
          RouterStatusModel.set(@interface.as_json(:allow_nan => true), scope: @scope)
          if !packet.identified?
            # Need to identify so we can find the target
            identified_packet = System.commands.identify(packet.buffer(false), @interface.cmd_target_names)
    Severity: Minor
    Found in openc3/lib/openc3/microservices/router_microservice.rb - About 1 hr to fix

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

          def listen_thread_body(listen_socket, listen_write, listen_read, thread_reader)
            begin
              socket, address = listen_socket.accept_nonblock
            rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR, Errno::EWOULDBLOCK
              read_ready, _ = IO.select([listen_socket, thread_reader])
      Severity: Minor
      Found in openc3/lib/openc3/interfaces/tcpip_server_interface.rb - About 1 hr to fix

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

          def screen_to_autocomplete_hash(autocomplete_data, keyword, data)
            # The snippet is what gets put in the file when you autocomplete
            # Thus we put the keyword with all the parameters surround by <>
            # e.g. SCREEN <Width> <Height> <Polling Period>
            # Example of building snippets:

          Function formatValue has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              formatValue(value) {
                if (
                  value &&
                  this.valueId &&
                  (this.valueId.includes('PACKET_TIMEFORMATTED') ||

            Function diff_fromDelta has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            diff_match_patch.prototype.diff_fromDelta = function (text1, delta) {
              var diffs = []
              var diffsLength = 0 // Keeping our own length var is faster in JS.
              var pointer = 0 // Cursor in text1
              var tokens = delta.split(/\t/g)

              Function patch_addContext_ has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.patch_addContext_ = function (patch, text) {
                if (text.length == 0) {
                  return
                }
                if (patch.start2 === null) {

                Method run has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def self.run
                      # Add parent to preexisting scope microservies and deploy new periodic and multi
                      ScopeModel.get_all_models(scope: nil).each do |scope, scope_model|
                        parent = "#{scope}__SCOPEMULTI__#{scope}"
                        model = MicroserviceModel.get_model(name: "#{scope}__OPENC3__LOG", scope: scope)
                Severity: Minor
                Found in openc3/lib/openc3/migrations/20221210174900_convert_to_multi.rb - About 1 hr to fix

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

                      def undeploy
                        errors = []
                        microservice_count = 0
                        microservices = MicroserviceModel.find_all_by_plugin(plugin: @name, scope: @scope)
                        microservices.each do |_name, model_instance|
                  Severity: Minor
                  Found in openc3/lib/openc3/models/plugin_model.rb - About 1 hr to fix

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

                        def initialize(
                          name:,
                          folder_name: nil,
                          requires: [],
                          ignored_parameters: [],
                    Severity: Minor
                    Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

                      Method to_xtce_int has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def to_xtce_int(item, param_or_arg, xml)
                            attrs = { :name => (item.name + '_Type') }
                            attrs[:initialValue] = item.default if item.default and !item.array_size
                            attrs[:shortDescription] = item.description if item.description
                            if item.states and item.default and item.states.key(item.default)
                      Severity: Minor
                      Found in openc3/lib/openc3/packets/parsers/xtce_converter.rb - About 1 hr to fix

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

                          async exec(
                            method,
                            params,
                            kwparams = {},
                            headerOptions = {},

                          Method handle_limits_values has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def handle_limits_values(item, value, limits_set, ignore_persistence)
                                # Retrieve limits settings for the specified limits_set
                                limits = item.limits.values[limits_set]
                          
                                # Use the default limits set if limits aren't specified for the
                          Severity: Minor
                          Found in openc3/lib/openc3/packets/packet.rb - About 1 hr to fix

                            Method build_cmd_output_string has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def build_cmd_output_string(target_name, cmd_name, cmd_params, raw = false)
                                  if raw
                                    output_string = 'cmd_raw("'
                                  else
                                    output_string = 'cmd("'
                            Severity: Minor
                            Found in openc3/lib/openc3/packets/commands.rb - About 1 hr to fix

                              Method write has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def write(packet)
                                    raise "Interface not connected for write: #{@name}" unless connected?
                                    raise "Interface not writable: #{@name}" unless write_allowed?
                              
                                    _write do
                              Severity: Minor
                              Found in openc3/lib/openc3/interfaces/interface.rb - About 1 hr to fix

                                Method instrument_script_implementation has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def self.instrument_script_implementation(ruby_lex_utils,
                                                                            comments_removed_text,
                                                                            _num_lines,
                                                                            filename,
                                                                            mark_private = false)
                                Severity: Minor
                                Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 1 hr to fix

                                  Method api has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def api
                                      OpenC3.in_span('jsonrpc_api') do |span|
                                        req = Rack::Request.new(request.env)
                                  
                                        if request.post?
                                  Severity: Minor
                                  Found in openc3-cosmos-cmd-tlm-api/app/controllers/api_controller.rb - About 1 hr to fix

                                    Function applySetting has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        applySetting(style, setting) {
                                          switch (setting[0]) {
                                            case 'TEXTALIGN':
                                              style['text-align'] = setting[1].toLowerCase() + ' !important'
                                              style['--text-align'] = setting[1].toLowerCase()

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

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

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

                                            def self.write(event, scope:)
                                              case event[:type]
                                              when :LIMITS_CHANGE
                                                # The current_limits hash keeps only the current limits state of items
                                                # It is used by the API to determine the overall limits state
                                        Severity: Minor
                                        Found in openc3/lib/openc3/topics/limits_event_topic.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language