OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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

  class TimelineEventsWebSocketApi < CmdTlmWebSocketApi
    def initialize(history_count: 0, url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeout: 5.0, authentication: nil, scope: $openc3_scope)
      @identifier = {
        channel: "TimelineEventsChannel",
        history_count: history_count
Severity: Major
Found in openc3/lib/openc3/script/web_socket_api.rb and 5 other locations - About 40 mins to fix
openc3/lib/openc3/script/web_socket_api.rb on lines 244..250
openc3/lib/openc3/script/web_socket_api.rb on lines 255..261
openc3/lib/openc3/script/web_socket_api.rb on lines 266..272
openc3/lib/openc3/script/web_socket_api.rb on lines 277..283
openc3/lib/openc3/script/web_socket_api.rb on lines 288..294

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

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 show
    return unless authorization('system')
    action do
      model_hash = @model_class.get(start: params[:id].to_i, scope: params[:scope])
      if model_hash
Severity: Minor
Found in openc3-cosmos-cmd-tlm-api/app/controllers/notes_controller.rb and 1 other location - About 40 mins to fix
openc3-cosmos-cmd-tlm-api/app/controllers/metadata_controller.rb on lines 108..116

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

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 generate_url
      schema = ENV['OPENC3_SCRIPT_API_SCHEMA'] || 'http'
      hostname = ENV['OPENC3_SCRIPT_API_HOSTNAME'] || (ENV['OPENC3_DEVEL'] ? '127.0.0.1' : 'openc3-cosmos-script-runner-api')
      port = ENV['OPENC3_SCRIPT_API_PORT'] || '2902'
      port = port.to_i
Severity: Minor
Found in openc3/lib/openc3/script/script.rb and 1 other location - About 40 mins to fix
openc3/lib/openc3/script/script.rb on lines 232..237

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

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 6 locations. Consider refactoring.
Open

  class CalendarEventsWebSocketApi < CmdTlmWebSocketApi
    def initialize(history_count: 0, url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeout: 5.0, authentication: nil, scope: $openc3_scope)
      @identifier = {
        channel: "CalendarEventsChannel",
        history_count: history_count
Severity: Major
Found in openc3/lib/openc3/script/web_socket_api.rb and 5 other locations - About 40 mins to fix
openc3/lib/openc3/script/web_socket_api.rb on lines 244..250
openc3/lib/openc3/script/web_socket_api.rb on lines 266..272
openc3/lib/openc3/script/web_socket_api.rb on lines 277..283
openc3/lib/openc3/script/web_socket_api.rb on lines 288..294
openc3/lib/openc3/script/web_socket_api.rb on lines 299..305

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

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 6 locations. Consider refactoring.
Open

  class SystemEventsWebSocketApi < CmdTlmWebSocketApi
    def initialize(history_count: 0, url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeout: 5.0, authentication: nil, scope: $openc3_scope)
      @identifier = {
        channel: "SystemEventsChannel",
        history_count: history_count
Severity: Major
Found in openc3/lib/openc3/script/web_socket_api.rb and 5 other locations - About 40 mins to fix
openc3/lib/openc3/script/web_socket_api.rb on lines 244..250
openc3/lib/openc3/script/web_socket_api.rb on lines 255..261
openc3/lib/openc3/script/web_socket_api.rb on lines 266..272
openc3/lib/openc3/script/web_socket_api.rb on lines 277..283
openc3/lib/openc3/script/web_socket_api.rb on lines 299..305

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

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

    def running_script_list(scope: $openc3_scope)
      endpoint = "/script-api/running-script"
      response = $script_runner_api_server.request('get', endpoint, scope: scope)
      if response.nil? || response.status != 200
        _script_response_error(response, "Running script list request failed", scope: scope)
Severity: Major
Found in openc3/lib/openc3/script/script_runner.rb and 2 other locations - About 40 mins to fix
openc3/lib/openc3/script/script_runner.rb on lines 31..38
openc3/lib/openc3/script/script_runner.rb on lines 241..248

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

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

Consider simplifying this complex logical expression.
Open

                    if not isinstance(error, StopScript) and (
                        not openc3.script.RUNNING_SCRIPT
                        or not openc3.script.RUNNING_SCRIPT.instance
                        or not openc3.script.RUNNING_SCRIPT.instance.exceptions
                        or error not in openc3.script.RUNNING_SCRIPT.instance.exceptions
Severity: Major
Found in openc3/python/openc3/script/suite.py - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

                if (
                    (plan_type == "GROUP_SETUP" and group_class == plan_group_class)
                    or (plan_type == "GROUP_TEARDOWN" and group_class == plan_group_class)
                    or (plan_script and group_class == plan_group_class)
                ):
    Severity: Major
    Found in openc3/python/openc3/script/suite.py - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if not (
                      (endianness == "LITTLE_ENDIAN")
                      and ((data_type == "INT") or (data_type == "UINT"))
                      and (
                          # Not byte aligned with an even bit size
      Severity: Major
      Found in openc3/python/openc3/accessors/binary_accessor.py - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                  if !((endianness == :LITTLE_ENDIAN) &&
                         ((data_type == :INT) || (data_type == :UINT)) &&
                         # Not byte aligned with an even bit size
                         (!((byte_aligned(bit_offset)) && (even_bit_size(bit_size)))) &&
                         (lower_bound < buffer_length)
        Severity: Major
        Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 40 mins to fix

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

                  if isinstance(buffer, bytearray):
                      # buffer[0:] syntax so we copy into the buffer
                      buffer[0:] = bytearray(json.dumps(decoded), encoding="utf-8")
          Severity: Minor
          Found in openc3/python/openc3/accessors/json_accessor.py and 1 other location - About 40 mins to fix
          openc3/python/openc3/accessors/json_accessor.py on lines 46..48

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

          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 isinstance(buffer, bytearray):
                      # buffer[0:] syntax so we copy into the buffer
                      buffer[0:] = bytearray(json.dumps(result), encoding="utf-8")
          Severity: Minor
          Found in openc3/python/openc3/accessors/json_accessor.py and 1 other location - About 40 mins to fix
          openc3/python/openc3/accessors/json_accessor.py on lines 64..66

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

          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 router_protocol_cmd(router_name, cmd_name, *cmd_params, read_write: :READ_WRITE, index: -1, manual: false, scope: $openc3_scope, token: $openc3_token)
                # TODO: Check if they have command authority for the targets mapped to this interface
                authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
                RouterTopic.protocol_cmd(router_name, cmd_name, *cmd_params, read_write: read_write, index: index, scope: scope)
          Severity: Minor
          Found in openc3/lib/openc3/api/router_api.rb and 1 other location - About 40 mins to fix
          openc3/lib/openc3/api/interface_api.rb on lines 156..159

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

          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 interface_protocol_cmd(interface_name, cmd_name, *cmd_params, read_write: :READ_WRITE, index: -1, manual: false, scope: $openc3_scope, token: $openc3_token)
                # TODO: Check if they have command authority for the targets mapped to this interface
                authorize(permission: 'system_set', interface_name: interface_name, manual: manual, scope: scope, token: token)
                InterfaceTopic.protocol_cmd(interface_name, cmd_name, *cmd_params, read_write: read_write, index: index, scope: scope)
          Severity: Minor
          Found in openc3/lib/openc3/api/interface_api.rb and 1 other location - About 40 mins to fix
          openc3/lib/openc3/api/router_api.rb on lines 132..135

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

          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

                limits_settings.each do |item, _limits_settings|
                  if packet_name
                    if item =~ /^#{target_name}__#{packet_name}__/
                      Store.hdel("#{scope}__current_limits_settings", item)
                    end
          Severity: Minor
          Found in openc3/lib/openc3/topics/limits_event_topic.rb and 1 other location - About 40 mins to fix
          openc3/lib/openc3/topics/limits_event_topic.rb on lines 142..149

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

          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

            acediff.editors.left.ace.getSession().on(
              'changeScrollTop',
              throttle(() => {
                updateGap(acediff)
              }, 16),
          openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 301..306

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

          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

            acediff.editors.right.ace.getSession().on(
              'changeScrollTop',
              throttle(() => {
                updateGap(acediff)
              }, 16),
          openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 295..300

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

          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

                limits.each do |item, _limits_state|
                  if packet_name
                    if item =~ /^#{target_name}__#{packet_name}__/
                      Store.hdel("#{scope}__current_limits", item)
                    end
          Severity: Minor
          Found in openc3/lib/openc3/topics/limits_event_topic.rb and 1 other location - About 40 mins to fix
          openc3/lib/openc3/topics/limits_event_topic.rb on lines 155..162

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

          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_bisectSplit_ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            text1,
            text2,
            x,
            y,
            deadline,

            Function display_screen has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def display_screen(target_name, screen_name, x=None, y=None, scope=OPENC3_SCOPE):
            Severity: Minor
            Found in openc3/python/openc3/script/screen.py - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language