OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

Avoid deeply nested control flow statements.
Open

          unless @out_of_order
            Logger.error("Log writer out of order time detected (increase buffer depth?): #{Time.from_nsec_from_epoch(@previous_time_nsec_since_epoch)} #{Time.from_nsec_from_epoch(time_nsec_since_epoch)}")
            @out_of_order = true
          end
Severity: Major
Found in openc3/lib/openc3/logs/log_writer.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if endianness == :LITTLE_ENDIAN
                  # Bitoffset always refers to the most significant bit of a bitfield
                  num_bytes = (((bit_offset % 8) + bit_size - 1) / 8) + 1
                  upper_bound = bit_offset / 8
                  lower_bound = upper_bound - num_bytes + 1
    Severity: Major
    Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if byte_aligned(bit_offset)
                  case bit_size
                  when 32
                    if endianness == :BIG_ENDIAN
                      buffer[lower_bound..upper_bound] = [value].pack(PACK_BIG_ENDIAN_32_BIT_FLOAT)
      Severity: Major
      Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if plugin_instance
                          if old_plugin_name
                            # And we're updating a plugin
                            data = File.read(plugin_instance)
                            json = JSON.parse(data, :allow_nan => true, :create_additions => true)
        Severity: Major
        Found in openc3/lib/openc3/utilities/local_mode.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if input == 'REJECTED'
                            raise "Critical Cmd Rejected"
                          end
          Severity: Major
          Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                          if packet_objects.length == 0
                            # Nothing left in either for this topic
                            @topics_and_offsets.delete(object.topic)
                          end
            Severity: Major
            Found in openc3-cosmos-cmd-tlm-api/app/models/streaming_object_collection.rb - About 45 mins to fix

              Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    dest_address,
                    dest_port,
                    src_port = nil,
                    multicast_interface_address = nil,
                    ttl = 1,
              Severity: Minor
              Found in openc3/lib/openc3/io/udp_sockets.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                if parsed_cmd["password"]
                                  running_script.user_input = parsed_cmd["password"].to_s
                                elsif parsed_cmd["multiple"]
                                  running_script.user_input = JSON.parse(parsed_cmd["multiple"])
                                  run_script_log(id, "Multiple input: #{running_script.user_input}")
                Severity: Major
                Found in openc3-cosmos-script-runner-api/scripts/run_script.rb - About 45 mins to fix

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

                      when :Z, :z, 3
                        rotation_matrix[0][0] = cos(rotation_angle_in_radians)
                        rotation_matrix[0][1] = sin(rotation_angle_in_radians)
                        rotation_matrix[1][1] = rotation_matrix[0][0]
                        rotation_matrix[1][0] = -(rotation_matrix[0][1])
                  Severity: Major
                  Found in openc3/lib/openc3/core_ext/matrix.rb and 2 other locations - About 45 mins to fix
                  openc3/lib/openc3/core_ext/matrix.rb on lines 65..69
                  openc3/lib/openc3/core_ext/matrix.rb on lines 70..74

                  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 40.

                  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

                        } else if (chunkType === C.DIFF_INSERT) {
                          diffs.push(
                            computeDiff(this, C.DIFF_INSERT, offset.left, offset.right, text),
                          )
                          offset.left += text.length
                  openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 246..256

                  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 50.

                  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

                        } else if (chunkType === C.DIFF_DELETE) {
                          diffs.push(
                            computeDiff(this, C.DIFF_DELETE, offset.left, offset.right, text),
                          )
                          offset.right += text.length
                  openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 251..256

                  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 50.

                  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

                      when :X, :x, 1
                        rotation_matrix[1][1] = cos(rotation_angle_in_radians)
                        rotation_matrix[1][2] = sin(rotation_angle_in_radians)
                        rotation_matrix[2][2] = rotation_matrix[1][1]
                        rotation_matrix[2][1] = -(rotation_matrix[1][2])
                  Severity: Major
                  Found in openc3/lib/openc3/core_ext/matrix.rb and 2 other locations - About 45 mins to fix
                  openc3/lib/openc3/core_ext/matrix.rb on lines 70..74
                  openc3/lib/openc3/core_ext/matrix.rb on lines 75..79

                  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 40.

                  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

                        if hash['read_conversion']
                          begin
                            item.read_conversion = OpenC3::const_get(hash['read_conversion']['class']).new(*hash['read_conversion']['params'])
                          rescue => error
                            Logger.instance.error "#{item.name} read_conversion of #{hash['read_conversion']} could not be instantiated due to #{error}"
                  Severity: Minor
                  Found in openc3/lib/openc3/packets/packet_item.rb and 1 other location - About 45 mins to fix
                  openc3/lib/openc3/packets/packet_item.rb on lines 559..564

                  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 40.

                  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

                      def self.connect_interface(interface_name, *interface_params, scope:)
                        if interface_params && !interface_params.empty?
                          Topic.write_topic("{#{scope}__CMD}INTERFACE__#{interface_name}", { 'connect' => 'true', 'params' => JSON.generate(interface_params) }, '*', 100)
                        else
                          Topic.write_topic("{#{scope}__CMD}INTERFACE__#{interface_name}", { 'connect' => 'true' }, '*', 100)
                  Severity: Minor
                  Found in openc3/lib/openc3/topics/interface_topic.rb and 1 other location - About 45 mins to fix
                  openc3/lib/openc3/topics/router_topic.rb on lines 66..71

                  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 40.

                  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

                    def add(data)
                      if validate_data(data)
                        begin
                          @broadcasters[uuid].add(data)
                        rescue OpenC3::AuthError, OpenC3::ForbiddenError
                  Severity: Minor
                  Found in openc3-cosmos-cmd-tlm-api/app/channels/streaming_channel.rb and 1 other location - About 45 mins to fix
                  openc3-cosmos-cmd-tlm-api/app/channels/streaming_channel.rb on lines 63..75

                  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 40.

                  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

                        new OpenC3Api()
                          .load_config(this.configKey, name)
                          .then((response) => {
                            if (response) {
                              this.$notify.normal({
                  openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/config/Config.js on lines 78..93

                  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 50.

                  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

                      when :Y, :y, 2
                        rotation_matrix[0][0] = cos(rotation_angle_in_radians)
                        rotation_matrix[2][0] = sin(rotation_angle_in_radians)
                        rotation_matrix[2][2] = rotation_matrix[0][0]
                        rotation_matrix[0][2] = -(rotation_matrix[2][0])
                  Severity: Major
                  Found in openc3/lib/openc3/core_ext/matrix.rb and 2 other locations - About 45 mins to fix
                  openc3/lib/openc3/core_ext/matrix.rb on lines 65..69
                  openc3/lib/openc3/core_ext/matrix.rb on lines 75..79

                  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 40.

                  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

                    def remove(data)
                      if validate_data(data)
                        begin
                          @broadcasters[uuid].remove(data)
                        rescue OpenC3::AuthError, OpenC3::ForbiddenError
                  Severity: Minor
                  Found in openc3-cosmos-cmd-tlm-api/app/channels/streaming_channel.rb and 1 other location - About 45 mins to fix
                  openc3-cosmos-cmd-tlm-api/app/channels/streaming_channel.rb on lines 44..56

                  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 40.

                  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

                      def self.connect_router(router_name, *router_params, scope:)
                        if router_params && !router_params.empty?
                          Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'connect' => 'true', 'params' => JSON.generate(router_params) }, '*', 100)
                        else
                          Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'connect' => 'true' }, '*', 100)
                  Severity: Minor
                  Found in openc3/lib/openc3/topics/router_topic.rb and 1 other location - About 45 mins to fix
                  openc3/lib/openc3/topics/interface_topic.rb on lines 56..61

                  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 40.

                  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

                        new OpenC3Api()
                          .save_config(this.configKey, name, JSON.stringify(config))
                          .then(() => {
                            this.$notify.normal({
                              title: 'Saved configuration',
                  openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/config/Config.js on lines 43..75

                  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 50.

                  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