OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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

  } else {
    sourceEditor = acediff.editors.right
    targetEditor = acediff.editors.left
    startLine = diff.rightStartLine
    endLine = diff.rightEndLine
openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 358..365

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

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 (dir === C.LTR) {
    sourceEditor = acediff.editors.left
    targetEditor = acediff.editors.right
    startLine = diff.leftStartLine
    endLine = diff.leftEndLine
openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 365..372

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

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

function simplifyDiffs(acediff, diffs) {
  const groupedDiffs = []

  function compare(val) {
    return acediff.options.diffGranularity === C.DIFF_GRANULARITY_SPECIFIC

    Method as_json has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def as_json(*a)
          config = {}
          config['target_name'] = @target_name.to_s
          config['packet_name'] = @packet_name.to_s
          config['endianness'] = @default_endianness.to_s
    Severity: Major
    Found in openc3/lib/openc3/packets/packet.rb - About 2 hrs to fix

      Method get_check_overflow_ranges has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def self.get_check_overflow_ranges(bit_size, data_type)
              min_value = 0 # Default for UINT cases
      
              case bit_size
              when 8
      Severity: Major
      Found in openc3/lib/openc3/accessors/binary_accessor.rb - About 2 hrs to fix

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

            def initialize(port_name = 'COM1',
                           baud_rate = 9600,
                           parity = :NONE,
                           stop_bits = 1,
                           write_timeout = 10.0,
        Severity: Major
        Found in openc3/lib/openc3/io/win32_serial_driver.rb - About 2 hrs to fix

          Method update_local_plugin has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.update_local_plugin(plugin_file_path, plugin_hash, old_plugin_name: nil, scope:)
                if ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
                  variables = plugin_hash['variables']
                  if variables
                    PluginModel::RESERVED_VARIABLE_NAMES.each do |name|
          Severity: Major
          Found in openc3/lib/openc3/utilities/local_mode.rb - About 2 hrs to fix

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

                      if (
                        Object.prototype.toString.call(value[i]).slice(8, -1) === 'String'
                      ) {
                        returnValue += '"' + value[i] + '"'
                      } else {
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/VWidget.js on lines 278..284

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

            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 (
                        Object.prototype.toString.call(value[i]).slice(8, -1) === 'String'
                      ) {
                        result += '"' + value[i] + '"'
                      } else {
            openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-cmdsender/src/tools/CommandSender/utilities.js on lines 81..87

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

            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 reaction_enabled_event(msg_hash)
                  @logger.debug "ReactionMicroservice reaction enabled msg_hash: #{msg_hash}"
                  reaction = JSON.parse(msg_hash['data'], :allow_nan => true, :create_additions => true)
                  @share.reaction_base.update(reaction: reaction)
            
            
            Severity: Major
            Found in openc3/lib/openc3/microservices/reaction_microservice.rb and 1 other location - About 2 hrs to fix
            openc3/lib/openc3/microservices/reaction_microservice.rb on lines 542..555

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

            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 reaction_created_event(msg_hash)
                  @logger.debug "ReactionMicroservice reaction created msg_hash: #{msg_hash}"
                  reaction = JSON.parse(msg_hash['data'], :allow_nan => true, :create_additions => true)
                  @share.reaction_base.add(reaction: reaction)
            
            
            Severity: Major
            Found in openc3/lib/openc3/microservices/reaction_microservice.rb and 1 other location - About 2 hrs to fix
            openc3/lib/openc3/microservices/reaction_microservice.rb on lines 561..574

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

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

            diff_match_patch.prototype.diff_lineMode_ = function (text1, text2, deadline) {
              // Scan the text on a line-by-line basis first.
              var a = this.diff_linesToChars_(text1, text2)
              text1 = a.chars1
              text2 = a.chars2

              Method deploy has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def deploy(gem_path, variables, validate_only: false)
                    variables["target_name"] = @name
                    start_path = "/targets/#{@folder_name}/"
                    temp_dir = Dir.mktmpdir
                    found = false
              Severity: Major
              Found in openc3/lib/openc3/models/target_model.rb - About 2 hrs to fix

                Method extract_fields_from_cmd_text has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def extract_fields_from_cmd_text(text, scope: $openc3_scope)
                      split_string = text.split(/\s+with\s+/i, 2)
                      raise "ERROR: text must not be empty" if split_string.length == 0
                      raise "ERROR: 'with' must be followed by parameters : #{text}" if (split_string.length == 1 and text =~ /\s*with\s*/i) or (split_string.length == 2 and split_string[1].empty?)
                
                
                Severity: Minor
                Found in openc3/lib/openc3/script/extract.rb - About 2 hrs to fix

                  Method process_file has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def process_file(filename, targets_config_dir)
                        parser = ConfigParser.new("https://docs.openc3.com/docs")
                  
                        # First pass - Everything except targets
                        parser.parse_file(filename) do |keyword, parameters|
                  Severity: Minor
                  Found in openc3/lib/openc3/system/system_config.rb - About 2 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if "expect" in line and ".to eql" in line:
                                line = line.replace("expect(", "self.assertEqual(")
                                line = re.sub(r"\)\.to eql(.*)", r", \1)", line)
                            elif "expect" in line and ".to eq" in line:
                                line = line.replace("expect(", "self.assertEqual(")
                    Severity: Critical
                    Found in openc3/python/ruby_to_python.py - About 2 hrs to fix

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

                          def read
                            raise "Interface not connected for read: #{@name}" unless connected?
                            raise "Interface not readable: #{@name}" unless read_allowed?
                      
                            first = true
                      Severity: Minor
                      Found in openc3/lib/openc3/interfaces/interface.rb - About 2 hrs to fix

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

                            def initialize(write_port_name,
                                           read_port_name,
                                           baud_rate,
                                           parity,
                                           stop_bits,
                        Severity: Minor
                        Found in openc3/lib/openc3/streams/serial_stream.rb - About 2 hrs to fix

                          Method evaluate_trigger has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def evaluate_trigger(head:, trigger:, visited:, triggers:)
                                if visited["#{trigger.name}__R"]
                                  return visited["#{trigger.name}__R"]
                                end
                                if visited["#{trigger.name}__P"].nil?
                          Severity: Minor
                          Found in openc3/lib/openc3/microservices/trigger_group_microservice.rb - About 1 hr to fix

                            Method from_json has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def self.from_json(hash)
                                  endianness = hash['endianness'] ? hash['endianness'].intern : nil # Convert to symbol
                                  packet = Packet.new(hash['target_name'], hash['packet_name'], endianness, hash['description'])
                                  packet.short_buffer_allowed = hash['short_buffer_allowed']
                                  packet.hazardous = hash['hazardous']
                            Severity: Minor
                            Found in openc3/lib/openc3/packets/packet.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language