OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

Function diff_cleanupMerge has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

diff_match_patch.prototype.diff_cleanupMerge = function (diffs) {
  // Add a dummy entry at the end.
  diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''))
  var pointer = 0
  var count_delete = 0

    Method read has 133 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.read(bit_offset, bit_size, data_type, buffer, endianness)
            given_bit_offset = bit_offset
            given_bit_size = bit_size
    
            bit_offset = check_bit_offset_and_size(:read, given_bit_offset, given_bit_size, data_type, buffer)
    Severity: Major
    Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 5 hrs to fix

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

      export default function getTheme(acediff, editor) {
        let { theme } = acediff.options
        if (editor === C.EDITOR_LEFT && acediff.options.left.theme !== null) {
          theme = acediff.options.left.theme
        }
      openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/visuals/getMode.js on lines 3..12

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

      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

      export default function getMode(acediff, editor) {
        let { mode } = acediff.options
        if (editor === C.EDITOR_LEFT && acediff.options.left.mode !== null) {
          mode = acediff.options.left.mode
        }
      openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/visuals/getTheme.js on lines 3..12

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

      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

      export class ConfigParserError {
        constructor(config_parser, message, usage = '', url = '') {
          this.keyword = config_parser.keyword
          this.parameters = config_parser.parameters
          this.filename = config_parser.filename
      openc3/templates/tool_svelte/src/services/config-parser.js on lines 23..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 139.

      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

      export class ConfigParserError {
        constructor(config_parser, message, usage = '', url = '') {
          this.keyword = config_parser.keyword
          this.parameters = config_parser.parameters
          this.filename = config_parser.filename
      Severity: Major
      Found in openc3/templates/tool_svelte/src/services/config-parser.js and 1 other location - About 5 hrs to fix
      openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/config-parser.js on lines 23..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 139.

      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

      Method read_array has 125 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.read_array(bit_offset, bit_size, data_type, array_size, buffer, endianness)
            # Save given values of bit offset, bit size, and array_size
            given_bit_offset = bit_offset
            given_bit_size = bit_size
            given_array_size = array_size
      Severity: Major
      Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 5 hrs to fix

        Function AceDiff has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function AceDiff(options = {}) {
          // Ensure instance is a constructor with `new`
          if (!(this instanceof AceDiff)) {
            return new AceDiff(options)
          }

          Method install_phase2 has 115 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.install_phase2(plugin_hash, scope:, gem_file_path: nil, validate_only: false)
                # Register plugin to aid in uninstall if install fails
                plugin_hash.delete("existing_plugin_txt_lines")
                plugin_model = PluginModel.new(**(plugin_hash.transform_keys(&:to_sym)), scope: scope)
                plugin_model.create unless validate_only
          Severity: Major
          Found in openc3/lib/openc3/models/plugin_model.rb - About 4 hrs to fix

            Method handle_config has 112 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def handle_config(parser, keyword, parameters)
                  case keyword
                  when 'CMD_BUFFER_DEPTH'
                    parser.verify_num_parameters(1, 1, "#{keyword} <Number of commands to buffer to ensure logged in order>")
                    @cmd_buffer_depth = parameters[0].to_i
            Severity: Major
            Found in openc3/lib/openc3/models/target_model.rb - About 4 hrs to fix

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

                if (
                  info.rightEndLine > info.rightStartLine &&
                  acediff.options.right.copyLinkEnabled
                ) {
                  const arrow = createArrow({
              openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 503..515

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

              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 (
                  info.leftEndLine > info.leftStartLine &&
                  acediff.options.left.copyLinkEnabled
                ) {
                  const arrow = createArrow({
              openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 517..529

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

              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_cleanupSemantic has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.diff_cleanupSemantic = function (diffs) {
                var changes = false
                var equalities = [] // Stack of indices where equalities are found.
                var equalitiesLength = 0 // Keeping our own length var is faster in JS.
                /** @type {?string} */

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

                  _cmd(method, target_name, command_name, param_list, headerOptions) {
                    let converted = null
                    for (let key in param_list) {
                      if (Object.prototype.hasOwnProperty.call(param_list, key)) {
                        converted = this.encode_openc3_type(param_list[key])
                Severity: Major
                Found in openc3/templates/tool_svelte/src/services/openc3-api.js and 1 other location - About 4 hrs to fix
                openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/openc3-api.js on lines 446..462

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

                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

                  _cmd(method, target_name, command_name, param_list, headerOptions) {
                    let converted = null
                    for (let key in param_list) {
                      if (Object.prototype.hasOwnProperty.call(param_list, key)) {
                        converted = this.encode_openc3_type(param_list[key])
                openc3/templates/tool_svelte/src/services/openc3-api.js on lines 386..402

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

                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

                const UnknownToAstroStatus = {
                  fatal: 'critical',
                  FATAL: 'critical',
                  error: 'critical',
                  ERROR: 'critical',
                openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/icons/index.js on lines 97..120

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

                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

                const UnknownToCosmosStatus = {
                  fatal: 'FATAL',
                  FATAL: 'FATAL',
                  error: 'ERROR',
                  ERROR: 'ERROR',
                openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/icons/index.js on lines 72..95

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

                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

                Method read has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def read(identify_and_define = true)
                      # Read entry length
                      length = @file.read(4)
                      return nil if !length or length.length <= 0
                
                
                Severity: Major
                Found in openc3/lib/openc3/logs/packet_log_reader.rb - About 4 hrs to fix

                  Method write_entry has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def write_entry(entry_type, cmd_or_tlm, target_name, packet_name, time_nsec_since_epoch, stored, data, id, received_time_nsec_since_epoch: nil, extra: nil)
                        raise ArgumentError.new("Length of id must be 64, got #{id.length}") if id and id.length != 64 # 64 hex digits, gets packed to 32 bytes with .pack('H*')
                  
                        length = OPENC3_PRIMARY_FIXED_SIZE
                        flags = 0
                  Severity: Major
                  Found in openc3/lib/openc3/logs/packet_log_writer.rb - About 4 hrs to fix

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

                        def initialize(target_name)
                          super(target_name)
                    
                          @target = System.targets[target_name]
                          position_filename = File.join(@target.dir, 'data', 'position.bin')
                      Severity
                      Category
                      Status
                      Source
                      Language