OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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

    def handle_packet(packet)
      RouterStatusModel.set(@interface.as_json(:allow_nan => true), scope: @scope)
      if !packet.identified?
        # Need to identify so we can find the target
        identified_packet = System.commands.identify(packet.buffer(false), @interface.cmd_target_names)
Severity: Minor
Found in openc3/lib/openc3/microservices/router_microservice.rb - About 1 hr to fix

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

        def listen_thread_body(listen_socket, listen_write, listen_read, thread_reader)
          begin
            socket, address = listen_socket.accept_nonblock
          rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR, Errno::EWOULDBLOCK
            read_ready, _ = IO.select([listen_socket, thread_reader])
    Severity: Minor
    Found in openc3/lib/openc3/interfaces/tcpip_server_interface.rb - About 1 hr to fix

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

        def screen_to_autocomplete_hash(autocomplete_data, keyword, data)
          # The snippet is what gets put in the file when you autocomplete
          # Thus we put the keyword with all the parameters surround by <>
          # e.g. SCREEN <Width> <Height> <Polling Period>
          # Example of building snippets:

        Function formatValue has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            formatValue(value) {
              if (
                value &&
                this.valueId &&
                (this.valueId.includes('PACKET_TIMEFORMATTED') ||

          Function diff_fromDelta has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          diff_match_patch.prototype.diff_fromDelta = function (text1, delta) {
            var diffs = []
            var diffsLength = 0 // Keeping our own length var is faster in JS.
            var pointer = 0 // Cursor in text1
            var tokens = delta.split(/\t/g)

            Function patch_addContext_ has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            diff_match_patch.prototype.patch_addContext_ = function (patch, text) {
              if (text.length == 0) {
                return
              }
              if (patch.start2 === null) {

              Method run has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.run
                    # Add parent to preexisting scope microservies and deploy new periodic and multi
                    ScopeModel.get_all_models(scope: nil).each do |scope, scope_model|
                      parent = "#{scope}__SCOPEMULTI__#{scope}"
                      model = MicroserviceModel.get_model(name: "#{scope}__OPENC3__LOG", scope: scope)
              Severity: Minor
              Found in openc3/lib/openc3/migrations/20221210174900_convert_to_multi.rb - About 1 hr to fix

                Method undeploy has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def undeploy
                      errors = []
                      microservice_count = 0
                      microservices = MicroserviceModel.find_all_by_plugin(plugin: @name, scope: @scope)
                      microservices.each do |_name, model_instance|
                Severity: Minor
                Found in openc3/lib/openc3/models/plugin_model.rb - About 1 hr to fix

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

                      def initialize(
                        name:,
                        folder_name: nil,
                        requires: [],
                        ignored_parameters: [],
                  Severity: Minor
                  Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

                    Method to_xtce_int has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def to_xtce_int(item, param_or_arg, xml)
                          attrs = { :name => (item.name + '_Type') }
                          attrs[:initialValue] = item.default if item.default and !item.array_size
                          attrs[:shortDescription] = item.description if item.description
                          if item.states and item.default and item.states.key(item.default)
                    Severity: Minor
                    Found in openc3/lib/openc3/packets/parsers/xtce_converter.rb - About 1 hr to fix

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

                        def disable
                          return unless authorization('script_run')
                          begin
                            model = @model_class.get(name: params[:name], group: params[:group], scope: params[:scope])
                            if model.nil?
                      openc3-cosmos-cmd-tlm-api/app/controllers/trigger_controller.rb on lines 203..219

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

                      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 enable
                          return unless authorization('script_run')
                          begin
                            model = @model_class.get(name: params[:name], group: params[:group], scope: params[:scope])
                            if model.nil?
                      openc3-cosmos-cmd-tlm-api/app/controllers/trigger_controller.rb on lines 239..255

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

                      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

                              value.size.times do |i|
                                range = (expected_value[i] - tolerance[i]..expected_value[i] + tolerance[i])
                                check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}[#{i}]"
                                range_str = "range #{range.first} to #{range.last} with value == #{value[i]} after waiting #{time_diff} seconds"
                                if range.include?(value[i])
                      Severity: Major
                      Found in openc3/lib/openc3/script/api_shared.rb and 1 other location - About 1 hr to fix
                      openc3/lib/openc3/script/api_shared.rb on lines 247..254

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

                      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

                              value.size.times do |i|
                                range = (expected_value[i] - tolerance[i]..expected_value[i] + tolerance[i])
                                wait_str = "WAIT: #{_upcase(target_name, packet_name, item_name)}[#{i}]"
                                range_str = "range #{range.first} to #{range.last} with value == #{value[i]} after waiting #{time} seconds"
                                if range.include?(value[i])
                      Severity: Major
                      Found in openc3/lib/openc3/script/api_shared.rb and 1 other location - About 1 hr to fix
                      openc3/lib/openc3/script/api_shared.rb on lines 356..363

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

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

                          def deploy_commmandlog_microservice(gem_path, variables, topics, instance = nil, parent = nil)
                            microservice_name = "#{@scope}__COMMANDLOG#{instance}__#{@name}"
                            microservice = MicroserviceModel.new(
                              name: microservice_name,
                              folder_name: @folder_name,
                      Severity: Major
                      Found in openc3/lib/openc3/models/target_model.rb and 3 other locations - About 1 hr to fix
                      openc3/lib/openc3/models/target_model.rb on lines 933..956
                      openc3/lib/openc3/models/target_model.rb on lines 959..982
                      openc3/lib/openc3/models/target_model.rb on lines 985..1008

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

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

                          def deploy_decomcmdlog_microservice(gem_path, variables, topics, instance = nil, parent = nil)
                            microservice_name = "#{@scope}__DECOMCMDLOG#{instance}__#{@name}"
                            microservice = MicroserviceModel.new(
                              name: microservice_name,
                              folder_name: @folder_name,
                      Severity: Major
                      Found in openc3/lib/openc3/models/target_model.rb and 3 other locations - About 1 hr to fix
                      openc3/lib/openc3/models/target_model.rb on lines 907..930
                      openc3/lib/openc3/models/target_model.rb on lines 959..982
                      openc3/lib/openc3/models/target_model.rb on lines 985..1008

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

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

                          def deploy_packetlog_microservice(gem_path, variables, topics, instance = nil, parent = nil)
                            microservice_name = "#{@scope}__PACKETLOG#{instance}__#{@name}"
                            microservice = MicroserviceModel.new(
                              name: microservice_name,
                              folder_name: @folder_name,
                      Severity: Major
                      Found in openc3/lib/openc3/models/target_model.rb and 3 other locations - About 1 hr to fix
                      openc3/lib/openc3/models/target_model.rb on lines 907..930
                      openc3/lib/openc3/models/target_model.rb on lines 933..956
                      openc3/lib/openc3/models/target_model.rb on lines 985..1008

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

                      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

                              when 1
                                q[1] = q[1].abs * Quaternion.signnz(rotation_matrix[2][0] - rotation_matrix[0][2])
                                q[0] = q[0].abs * Quaternion.signnz((rotation_matrix[1][0] + rotation_matrix[0][1]) * q[1])
                                q[2] = q[2].abs * Quaternion.signnz((rotation_matrix[2][1] + rotation_matrix[1][2]) * q[1])
                      Severity: Major
                      Found in openc3/lib/openc3/utilities/quaternion.rb and 1 other location - About 1 hr to fix
                      openc3/lib/openc3/utilities/quaternion.rb on lines 242..245

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

                      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

                              when 0
                                q[0] = q[0].abs * Quaternion.signnz(rotation_matrix[1][2] - rotation_matrix[2][1])
                                q[1] = q[1].abs * Quaternion.signnz((rotation_matrix[1][0] + rotation_matrix[0][1]) * q[0])
                                q[2] = q[2].abs * Quaternion.signnz((rotation_matrix[2][0] + rotation_matrix[0][2]) * q[0])
                      Severity: Major
                      Found in openc3/lib/openc3/utilities/quaternion.rb and 1 other location - About 1 hr to fix
                      openc3/lib/openc3/utilities/quaternion.rb on lines 246..249

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

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

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

                      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