OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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-cmd-tlm-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 TelemetryReducedDayTopic < 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 45..58

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

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

    def set_option(option_name, option_values)
      super(option_name, option_values)
      case option_name.upcase
      when 'USERNAME'
        @username = option_values[0]
Severity: Major
Found in openc3/lib/openc3/interfaces/mqtt_stream_interface.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/interfaces/mqtt_interface.rb on lines 228..243

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

          x = (f[1] * f[2]) - (f[0] * f[1])
          y = (f[0] * f[0]) + (f[2] * f[2])
          z = (-f[2] * f[1]) - (f[1] * f[0])
Severity: Major
Found in openc3/lib/openc3/utilities/quaternion.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/utilities/quaternion.rb on lines 173..175

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

    def self.handle_config(parser, keyword, parameters, plugin: nil, needs_dependencies: false, scope:)
      case keyword
      when 'INTERFACE'
        parser.verify_num_parameters(2, nil, "INTERFACE <Name> <Filename> <Specific Parameters>")
        return self.new(name: parameters[0].upcase, config_params: parameters[1..-1], plugin: plugin, needs_dependencies: needs_dependencies, scope: scope)
Severity: Major
Found in openc3/lib/openc3/models/interface_model.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/models/router_model.rb on lines 28..34

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

    def self.handle_config(parser, keyword, parameters, plugin: nil, needs_dependencies: false, scope:)
      case keyword
      when 'ROUTER'
        parser.verify_num_parameters(2, nil, "ROUTER <Name> <Filename> <Specific Parameters>")
        return self.new(name: parameters[0].upcase, config_params: parameters[1..-1], plugin: plugin,  needs_dependencies: needs_dependencies, scope: scope)
Severity: Major
Found in openc3/lib/openc3/models/router_model.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/models/interface_model.rb on lines 72..78

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

          x = (f[0] * f[2]) - (f[2] * f[1])
          y = (f[2] * f[0]) + (f[1] * f[2])
          z = (-f[1] * f[1]) - (f[0] * f[0])
Severity: Major
Found in openc3/lib/openc3/utilities/quaternion.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/utilities/quaternion.rb on lines 177..179

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

module OpenC3
  class BridgeInterfaceThread < InterfaceThread
    protected

    def handle_packet(packet)
Severity: Major
Found in openc3/lib/openc3/bridge/bridge_interface_thread.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/bridge/bridge_router_thread.rb on lines 25..40

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

module OpenC3
  class BridgeRouterThread < InterfaceThread
    protected

    def handle_packet(packet)
Severity: Major
Found in openc3/lib/openc3/bridge/bridge_router_thread.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/bridge/bridge_interface_thread.rb on lines 25..40

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

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

    def set_option(option_name, option_values)
      super(option_name, option_values)
      case option_name.upcase
      when 'USERNAME'
        @username = option_values[0]
Severity: Major
Found in openc3/lib/openc3/interfaces/mqtt_interface.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/interfaces/mqtt_stream_interface.rb on lines 66..81

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

Function diff_cleanupSplitSurrogates has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

diff_match_patch.prototype.diff_cleanupSplitSurrogates = function (diffs) {
  var lastEnd
  for (var x = 0; x < diffs.length; x++) {
    var thisDiff = diffs[x]
    var thisTop = thisDiff[1][0]

    Function diff_prettyHtml has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_prettyHtml = function (diffs) {
      diffs = this.diff_cleanupSplitSurrogates(diffs)
      var html = []
      var pattern_amp = /&/g
      var pattern_lt = /</g

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

          def __init__(
              self,
              remote_log_directory,
              logging_enabled=True,
              cycle_time=None,
      Severity: Minor
      Found in openc3/python/openc3/logs/log_writer.py - About 1 hr to fix

        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
                      Severity
                      Category
                      Status
                      Source
                      Language