OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

Method get_tlm_values has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.get_tlm_values(items, stale_time: 30, cache_timeout: nil, scope: $openc3_scope)
      now = Time.now
      results = []
      lookups = []
      packet_lookup = {}
Severity: Minor
Found in openc3/lib/openc3/models/cvt_model.rb - About 1 hr to fix

    Method finish_packet has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def finish_packet
          if @current_packet
            warnings = @current_packet.check_bit_offsets
            if warnings.length > 0
              raise "Overlapping items not allowed in tables.\n#{warnings}"
    Severity: Minor
    Found in openc3/lib/openc3/tools/table_manager/table_config.rb - About 1 hr to fix

      Method qfromc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.qfromc(rotation_matrix)
            tracec = rotation_matrix.trace()
            p = 1.0 + tracec
            if p < 0.0
              p = 0.0
      Severity: Minor
      Found in openc3/lib/openc3/utilities/quaternion.rb - About 1 hr to fix

        Method _build_cmd_output_string has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def _build_cmd_output_string(method_name, target_name, cmd_name, cmd_params, packet)
              output_string = "#{method_name}(\""
              output_string << (target_name + ' ' + cmd_name)
              if cmd_params.nil? or cmd_params.empty?
                output_string << '")'
        Severity: Minor
        Found in openc3/lib/openc3/api/cmd_api.rb - About 1 hr to fix

          Method calc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def calc(data, seed = @seed)
                  crc = seed
          
                  case @bit_size
                  when 8
          Severity: Minor
          Found in openc3/lib/openc3/utilities/crc.rb - About 1 hr to fix

            Method generate_tool has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.generate_tool(args)
                  if args.length < 2 or args.length > 3
                    abort("Usage: cli generate #{args[0]} 'Tool Name' (--ruby or --python)")
                  end
            
            
            Severity: Minor
            Found in openc3/lib/openc3/utilities/cli_generator.rb - About 1 hr to fix

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

                  def initialize(port_name = '/dev/ttyS0',
                                 baud_rate = 9600,
                                 parity = :NONE,
                                 stop_bits = 1,
                                 write_timeout = 10.0,
              Severity: Minor
              Found in openc3/lib/openc3/io/posix_serial_driver.rb - About 1 hr to fix

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

                        endpoint = "/openc3-api/packages/#{package_name}?scope=#{scope}"
                        uri = URI.parse($api_server.generate_url + endpoint)
                        auth = $api_server.generate_auth
                        request = Net::HTTP::Delete.new(uri)
                        request['User-Agent'] = JsonDRbObject::USER_AGENT
                Severity: Major
                Found in openc3/lib/openc3/script/packages.rb and 1 other location - About 1 hr to fix
                openc3/lib/openc3/script/plugins.rb on lines 144..154

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

                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

                python_files.each do |rel_path|
                  full_path = File.join(base_path, rel_path)
                  data = nil
                  File.open(full_path, 'rb') do |file|
                    data = file.read
                Severity: Major
                Found in scripts/release/openc3_set_versions.rb and 1 other location - About 1 hr to fix
                scripts/release/openc3_set_versions.rb on lines 77..96

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

                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

                        state.raw_values.each do |key, value|
                          if value
                            vals_key = "#{key}__VALS"
                            reduced[vals_key] ||= []
                            reduced[vals_key] << value
                Severity: Major
                Found in openc3/lib/openc3/microservices/reducer_microservice.rb and 1 other location - About 1 hr to fix
                openc3/lib/openc3/microservices/reducer_microservice.rb on lines 402..412

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

                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

                gemspec_files.each do |rel_path|
                  full_path = File.join(base_path, rel_path)
                  data = nil
                  File.open(full_path, 'rb') do |file|
                    data = file.read
                Severity: Major
                Found in scripts/release/openc3_set_versions.rb and 1 other location - About 1 hr to fix
                scripts/release/openc3_set_versions.rb on lines 207..226

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

                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

                        state.converted_values.each do |key, value|
                          if value
                            cvals_key = "#{key}__CVALS"
                            reduced[cvals_key] ||= []
                            reduced[cvals_key] << value
                Severity: Major
                Found in openc3/lib/openc3/microservices/reducer_microservice.rb and 1 other location - About 1 hr to fix
                openc3/lib/openc3/microservices/reducer_microservice.rb on lines 387..397

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

                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

                        endpoint = "/openc3-api/plugins/#{plugin_name}?scope=#{scope}"
                        uri = URI.parse($api_server.generate_url + endpoint)
                        auth = $api_server.generate_auth
                        request = Net::HTTP::Delete.new(uri)
                        request['User-Agent'] = JsonDRbObject::USER_AGENT
                Severity: Major
                Found in openc3/lib/openc3/script/plugins.rb and 1 other location - About 1 hr to fix
                openc3/lib/openc3/script/packages.rb on lines 79..89

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

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

                    def set(
                Severity: Major
                Found in openc3/python/openc3/packets/limits.py - About 1 hr to fix

                  Method set has 12 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def set(target_name, packet_name, item_name, red_low, yellow_low, yellow_high, red_high, green_low = nil, green_high = nil, limits_set = :CUSTOM, persistence = nil, enabled = true)
                  Severity: Major
                  Found in openc3/lib/openc3/packets/limits.rb - About 1 hr to fix

                    Method initialize has 12 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          hostname,
                          port,
                          handshake_enabled = true,
                          response_timeout = 5.0,
                          read_timeout = nil,
                    Severity: Major
                    Found in openc3/lib/openc3/interfaces/linc_interface.rb - About 1 hr to fix

                      Method set_limits has 12 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def set_limits(target_name, packet_name, item_name, red_low, yellow_low, yellow_high, red_high,
                                         green_low = nil, green_high = nil, limits_set = 'CUSTOM', persistence = nil, enabled = true,
                                         manual: false, scope: $openc3_scope, token: $openc3_token)
                      Severity: Major
                      Found in openc3/lib/openc3/api/limits_api.rb - About 1 hr to fix

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

                            if (
                              // dense, but this accommodates two scenarios:
                              // 1. where a completely fresh new line is being inserted in left editor, we want the line on right to stay a 1px line
                              // 2. where a new character is inserted at the start of a newline on the left but the line contains other stuff,
                              //    we DO want to make it a full line
                        openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 627..640

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

                        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 (
                              // dense, but this accommodates two scenarios:
                              // 1. where a completely fresh new line is being inserted in left editor, we want the line on right to stay a 1px line
                              // 2. where a new character is inserted at the start of a newline on the left but the line contains other stuff,
                              //    we DO want to make it a full line
                        openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/index.js on lines 587..600

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

                        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 _extract_target_command_names(method_name, *args)
                              target_name = nil
                              command_name = nil
                              case args.length
                              when 1
                        Severity: Major
                        Found in openc3/lib/openc3/api/cmd_api.rb and 1 other location - About 1 hr to fix
                        openc3/lib/openc3/api/tlm_api.rb on lines 426..442

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language