OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

Function setHeight has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    setHeight(height, units = 'px', defaultHeight = '20') {
      // Don't set the height if someone has already set it
      let foundSetting = null
      if (this.widgetIndex !== null) {
        foundSetting = this.settings.find(

    Function setWidth has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setWidth(width, units = 'px', defaultWidth = '120') {
          // Don't set the width if someone has already set it
          // This is important in PacketViewer which uses the value-widget
          // and passes an explicit width setting to use
          let foundSetting = null

      Method update_raw_hour_day_stats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

              def initialize(target_name = nil, packet_name = nil, default_endianness = :BIG_ENDIAN, description = nil, buffer = nil, item_class = PacketItem)
                super(default_endianness, buffer, item_class)
                # Explicitly call the defined setter methods
                self.target_name = target_name
                self.packet_name = packet_name
        Severity: Minor
        Found in openc3/lib/openc3/packets/packet.rb - About 1 hr to fix

          Method disconnect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def disconnect
                @cancel_threads = true
                @read_queue << nil if @read_queue
                @listen_pipes.each do |pipe|
                  pipe.write('.')
          Severity: Minor
          Found in openc3/lib/openc3/interfaces/tcpip_server_interface.rb - About 1 hr to fix

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

                def connect
                  if @read_port and @write_dest_port and @write_src_port and (@read_port == @write_src_port)
                    @read_socket = UdpReadWriteSocket.new(
                      @read_port,
                      @bind_address,
            Severity: Minor
            Found in openc3/lib/openc3/interfaces/udp_interface.rb - About 1 hr to fix

              Method to_xtce_string has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def to_xtce_string(item, param_or_arg, xml, string_or_binary)
                    # TODO: OpenC3 Variably sized strings are not supported in XTCE
                    attrs = { :name => (item.name + '_Type') }
                    attrs[:characterWidth] = 8 if string_or_binary == 'String'
                    if item.default && !item.array_size
              Severity: Minor
              Found in openc3/lib/openc3/packets/parsers/xtce_converter.rb - About 1 hr to fix

                Method build_target_archive has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def build_target_archive(temp_dir, target_folder)
                      target_files = []
                      Find.find(target_folder) { |file| target_files << file }
                      target_files.sort!
                      @id = OpenC3.hash_files(target_files, nil, 'SHA256').hexdigest
                Severity: Minor
                Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

                  Method process_array_type has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def process_array_type(element, bit_size)
                        array_num_items = 1
                        # Need to determine dimensions
                        xtce_recurse_element(element) do |block_element|
                          if block_element.name == 'Dimension'
                  Severity: Minor
                  Found in openc3/lib/openc3/packets/parsers/xtce_parser.rb - About 1 hr to fix

                    Method normalize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.normalize(target_name, packet_name, item_name, type: :ALL, scope: $openc3_scope)
                          hash = Store.hget("#{scope}__override__#{target_name}", packet_name)
                          hash = JSON.parse(hash, :allow_nan => true, :create_additions => true) if hash
                          hash ||= {} # In case the above didn't create anything
                          case type
                    Severity: Minor
                    Found in openc3/lib/openc3/models/cvt_model.rb - About 1 hr to fix

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

                          def initialize(commands, telemetry, output_dir)
                            FileUtils.mkdir_p(output_dir)
                      
                            # Build target list
                            targets = []
                      Severity: Minor
                      Found in openc3/lib/openc3/packets/parsers/xtce_converter.rb - About 1 hr to fix

                        Method write_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def write_data(data, extra = nil)
                              # Intentionally not calling super()
                        
                              need_insert = false
                              result_data = ''
                        Severity: Minor
                        Found in openc3/lib/openc3/interfaces/protocols/cobs_protocol.rb - About 1 hr to fix

                          Method overrides has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def self.overrides(scope: $openc3_scope)
                                overrides = []
                                TargetModel.names(scope: scope).each do |target_name|
                                  all = Store.hgetall("#{scope}__override__#{target_name}")
                                  next if all.nil? or all.empty?
                          Severity: Minor
                          Found in openc3/lib/openc3/models/cvt_model.rb - About 1 hr to fix

                            Method process_ref_entry has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def process_ref_entry(element)
                                  reference_location, bit_offset = xtce_handle_location_in_container_in_bits(element)
                                  object, type, data_type, array_type = get_object_types(element)
                                  bit_size = Integer(type.sizeInBits)
                                  if array_type
                            Severity: Minor
                            Found in openc3/lib/openc3/packets/parsers/xtce_parser.rb - About 1 hr to fix

                              Method convert_to_type has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def self.convert_to_type(value, item)
                                    return value if value.nil?
                                    case item.data_type
                                    when :OBJECT, :ARRAY
                                      # Do nothing for complex object types
                              Severity: Minor
                              Found in openc3/lib/openc3/accessors/accessor.rb - About 1 hr to fix

                                Method create_table has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def create_table(tables, warnings)
                                      params = @parser.parameters
                                      table_name = params[0].to_s.upcase
                                      endianness = params[1].to_s.upcase.to_sym
                                      if endianness != :BIG_ENDIAN && endianness != :LITTLE_ENDIAN
                                Severity: Minor
                                Found in openc3/lib/openc3/tools/table_manager/table_parser.rb - About 1 hr to fix

                                  Method action has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def action
                                      begin
                                        yield
                                      rescue ArgumentError, TypeError => e
                                        logger.error(e.formatted)
                                  Severity: Minor
                                  Found in openc3-cosmos-cmd-tlm-api/app/controllers/notes_controller.rb - About 1 hr to fix

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                      class TelemetryReducedHourTopic < Topic
                                        def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
                                          OpenC3.in_span("write") do
                                            # Write to stream
                                            msg_hash = {
                                    Severity: Major
                                    Found in openc3/lib/openc3/topics/telemetry_reduced_topics.rb and 2 other locations - About 1 hr to fix
                                    openc3/lib/openc3/topics/telemetry_reduced_topics.rb on lines 27..40
                                    openc3/lib/openc3/topics/telemetry_reduced_topics.rb on lines 63..76

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 51.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                    module ApplicationCable
                                      class Connection < ActionCable::Connection::Base
                                        include OpenC3::Authorization
                                    
                                        identified_by :uuid
                                    openc3-cosmos-script-runner-api/app/channels/application_cable/connection.rb on lines 21..44

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 51.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                      class TelemetryReducedMinuteTopic < Topic
                                        def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
                                          OpenC3.in_span("write") do
                                            # Write to stream
                                            msg_hash = {
                                    Severity: Major
                                    Found in openc3/lib/openc3/topics/telemetry_reduced_topics.rb and 2 other locations - About 1 hr to fix
                                    openc3/lib/openc3/topics/telemetry_reduced_topics.rb on lines 45..58
                                    openc3/lib/openc3/topics/telemetry_reduced_topics.rb on lines 63..76

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 51.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language