OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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

    def start_raw_logging_router(router_name = 'ALL', 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)
      if router_name == 'ALL'
        get_router_names().each do |router_name|
Severity: Major
Found in openc3/lib/openc3/api/router_api.rb and 3 other locations - About 50 mins to fix
openc3/lib/openc3/api/interface_api.rb on lines 84..92
openc3/lib/openc3/api/interface_api.rb on lines 99..107
openc3/lib/openc3/api/router_api.rb on lines 97..105

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

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

      if (error.response.status === 401) {
        OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity, true).then(
          function (refreshed) {
            if (refreshed) {
              OpenC3Auth.setTokens()
Severity: Minor
Found in openc3/templates/tool_svelte/src/services/axios.js and 1 other location - About 50 mins to fix
openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/axios.js on lines 38..46

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

diff_match_patch.prototype.isHighSurrogate = function (c) {
  var v = c.charCodeAt(0)
  return v >= 0xd800 && v <= 0xdbff
}
openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/diff-match-patch.js on lines 1379..1382

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

diff_match_patch.prototype.isLowSurrogate = function (c) {
  var v = c.charCodeAt(0)
  return v >= 0xdc00 && v <= 0xdfff
}
openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/diff-match-patch.js on lines 1374..1377

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

      if (error.response.status === 401) {
        OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity, true).then(
          function (refreshed) {
            if (refreshed) {
              OpenC3Auth.setTokens()
openc3/templates/tool_svelte/src/services/axios.js on lines 35..43

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

    def create(update: false)
      validate_start(update: update)
      @updated_at = Time.now.to_nsec_from_epoch
      SortedModel.destroy(scope: @scope, start: update) if update
      Store.zadd(@primary_key, @start, JSON.generate(as_json(:allow_nan => true)))
Severity: Major
Found in openc3/lib/openc3/models/sorted_model.rb and 2 other locations - About 45 mins to fix
openc3/lib/openc3/models/metadata_model.rb on lines 117..125
openc3/lib/openc3/models/note_model.rb on lines 100..108

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

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

          case keyword
          # Complete a generic conversion
          when 'GENERIC_READ_CONVERSION_END', 'GENERIC_WRITE_CONVERSION_END'
            parser.verify_num_parameters(0, 0, keyword)
            @current_item.read_conversion =
Severity: Minor
Found in openc3/lib/openc3/packets/packet_config.rb and 1 other location - About 45 mins to fix
openc3/lib/openc3/tools/table_manager/table_config.rb on lines 95..114

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

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

          case keyword
          # Complete a generic conversion
          when 'GENERIC_READ_CONVERSION_END', 'GENERIC_WRITE_CONVERSION_END'
            parser.verify_num_parameters(0, 0, keyword)
            @current_item.read_conversion =
Severity: Minor
Found in openc3/lib/openc3/tools/table_manager/table_config.rb and 1 other location - About 45 mins to fix
openc3/lib/openc3/packets/packet_config.rb on lines 148..163

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

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 create(update: false)
      validate(update: update)
      @updated_at = Time.now.to_nsec_from_epoch
      NoteModel.destroy(scope: @scope, start: update) if update
      Store.zadd(@primary_key, @start, JSON.generate(as_json(:allow_nan => true)))
Severity: Major
Found in openc3/lib/openc3/models/note_model.rb and 2 other locations - About 45 mins to fix
openc3/lib/openc3/models/metadata_model.rb on lines 117..125
openc3/lib/openc3/models/sorted_model.rb on lines 131..139

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

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 create(update: false)
      validate(update: update)
      @updated_at = Time.now.to_nsec_from_epoch
      MetadataModel.destroy(scope: @scope, start: update) if update
      Store.zadd(@primary_key, @start, JSON.generate(as_json(:allow_nan => true)))
Severity: Major
Found in openc3/lib/openc3/models/metadata_model.rb and 2 other locations - About 45 mins to fix
openc3/lib/openc3/models/note_model.rb on lines 100..108
openc3/lib/openc3/models/sorted_model.rb on lines 131..139

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

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

Avoid deeply nested control flow statements.
Open

            for (const param of lineObj.mnemonic.params) {
              if (!items.some((item) => item === param)) {
                problemLines.push({
                  ...lineObj,
                  error: `Command "${target} ${packet}" param "${param}" does not exist.`,

    Avoid deeply nested control flow statements.
    Open

              for (var y = 0; y < patches[x].diffs.length; y++) {
                var mod = patches[x].diffs[y]
                if (mod[0] !== DIFF_EQUAL) {
                  index2 = this.diff_xIndex(diffs, index1)
                }

      Avoid deeply nested control flow statements.
      Open

                              if msg_type == "disconnect":
                                  if json_hash["reason"] == "unauthorized":
                                      raise RuntimeError("Unauthorized")
                              if msg_type == "reject_subscription":
      Severity: Major
      Found in openc3/python/openc3/script/web_socket_api.py - About 45 mins to fix

        Function _log_cmd has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _log_cmd(target_name, cmd_name, cmd_params, raw, no_range, no_hazardous):
        Severity: Minor
        Found in openc3/python/openc3/script/commands.py - About 45 mins to fix

          Function build_cmd has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def build_cmd(cls, target_name, cmd_name, cmd_params, range_check, raw, scope=OPENC3_SCOPE):
          Severity: Minor
          Found in openc3/python/openc3/topics/decom_interface_topic.py - About 45 mins to fix

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Minor
            Found in openc3/python/openc3/script/web_socket_api.py - About 45 mins to fix

              Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in openc3/python/openc3/script/web_socket_api.py - About 45 mins to fix

                Function prompt has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def prompt(
                Severity: Minor
                Found in openc3/python/openc3/script/__init__.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (commonlength !== 0) {
                                if (
                                  pointer - count_delete - count_insert > 0 &&
                                  diffs[pointer - count_delete - count_insert - 1][0] ==
                                    DIFF_EQUAL

                    Function protocol_cmd has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def protocol_cmd(
                    Severity: Minor
                    Found in openc3/python/openc3/topics/router_topic.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language