OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

Function addEventHandlers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function addEventHandlers(acediff) {
  acediff.editors.left.ace.getSession().on(
    'changeScrollTop',
    throttle(() => {
      updateGap(acediff)

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

        def read
          packet = nil
          if @connected
            while true
              packet = first_pending_packet()
    Severity: Minor
    Found in openc3/lib/openc3/interfaces/simulated_target_interface.rb - About 1 hr to fix

      Method connect has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def connect
            # Packet definitions need to be retrieved here because @target_names is not filled in until after initialize
            unless @handshake_enableds
              @handshake_enableds = {}
              @target_names.each do |target_name|
      Severity: Minor
      Found in openc3/lib/openc3/interfaces/linc_interface.rb - About 1 hr to fix

        Method report has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.report(binary, definition_filename, requested_table_name = nil)
              report = StringIO.new
              config = TableConfig.process_file(definition_filename)
              begin
                load_binary(config, binary)
        Severity: Minor
        Found in openc3/lib/openc3/tools/table_manager/table_manager_core.rb - About 1 hr to fix

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

            def enable
              return unless authorization('script_run')
              begin
                model = @model_class.get(name: params[:name], scope: params[:scope])
                if model.nil?
          openc3-cosmos-cmd-tlm-api/app/controllers/reaction_controller.rb on lines 228..244
          openc3-cosmos-cmd-tlm-api/app/controllers/reaction_controller.rb on lines 248..264

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

          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/packages?scope=#{scope}"
                  uri = URI.parse($api_server.generate_url + endpoint)
                  auth = $api_server.generate_auth
          
                  request = Net::HTTP::Get.new(uri)
          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 26..38

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

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

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

          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?scope=#{scope}"
                  uri = URI.parse($api_server.generate_url + endpoint)
                  auth = $api_server.generate_auth
          
                  request = Net::HTTP::Get.new(uri)
          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 28..40

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

          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

          module OpenC3
            class StashModel < Model
              PRIMARY_KEY = 'openc3__stash'
          
              # NOTE: The following three class methods are used by the ModelController
          Severity: Major
          Found in openc3/lib/openc3/models/stash_model.rb and 1 other location - About 1 hr to fix
          openc3/lib/openc3/models/secret_model.rb on lines 21..49

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

          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

          module OpenC3
            class SecretModel < Model
              PRIMARY_KEY = 'openc3__secrets'
          
              # NOTE: The following three class methods are used by the ModelController
          Severity: Major
          Found in openc3/lib/openc3/models/secret_model.rb and 1 other location - About 1 hr to fix
          openc3/lib/openc3/models/stash_model.rb on lines 21..49

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

            def execute
              return unless authorization('script_run')
              begin
                model = @model_class.get(name: params[:name], scope: params[:scope])
                if model.nil?
          openc3-cosmos-cmd-tlm-api/app/controllers/reaction_controller.rb on lines 193..209
          openc3-cosmos-cmd-tlm-api/app/controllers/reaction_controller.rb on lines 228..244

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

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

            async exec(method, params, kwparams = {}, headerOptions = {}) {
              try {
                let refreshed = await OpenC3Auth.updateToken(
                  OpenC3Auth.defaultMinValidity,
                )
          Severity: Minor
          Found in openc3/templates/tool_svelte/src/services/openc3-api.js - About 1 hr to fix

            Method to_config has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def to_config(output_dir)
                  FileUtils.mkdir_p(output_dir)
            
                  @telemetry.each do |target_name, packets|
                    next if target_name == 'UNKNOWN'
            Severity: Minor
            Found in openc3/lib/openc3/packets/packet_config.rb - About 1 hr to fix

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

                  def undeploy
                    prefix = "#{@scope}/targets/#{@name}/"
                    @bucket.list_objects(bucket: ENV['OPENC3_CONFIG_BUCKET'], prefix: prefix).each do |object|
                      @bucket.delete_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: object.key)
                    end
              Severity: Minor
              Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

                Method cycle_thread_body has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def cycle_thread_body
                      @@cycle_sleeper = Sleeper.new
                      while true
                        start_time = Time.now
                        @@mutex.synchronize do
                Severity: Minor
                Found in openc3/lib/openc3/logs/log_writer.rb - About 1 hr to fix

                  Method set_limits has 44 lines of code (exceeds 25 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)
                        authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
                        if (red_low > yellow_low) || (yellow_low >= yellow_high) || (yellow_high > red_high)
                  Severity: Minor
                  Found in openc3/lib/openc3/api/limits_api.rb - About 1 hr to fix

                    Method analyze_local_mode has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.analyze_local_mode(plugin_name:, scope:)
                          if ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
                            # We already know a plugin with this name doesn't exist in the models
                            # Now need to determine if there is a highly likely candidate that has been
                            # updated, so that we don't do an erroneous extra plugin install
                    Severity: Minor
                    Found in openc3/lib/openc3/utilities/local_mode.rb - About 1 hr to fix

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

                        def initialize(id, scope, name, disconnect)
                          @@instance = self
                          @id = id
                          @@id = id
                          @scope = scope
                      Severity: Minor
                      Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 1 hr to fix

                        Method redis_thread_body has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def redis_thread_body
                            topics, offsets, item_objects_by_topic, packet_objects_by_topic = @collection.topics_offsets_and_objects
                            results = []
                            if topics.length > 0
                              # 500ms timeout to allow for thread to shutdown within 1 second
                        Severity: Minor
                        Found in openc3-cosmos-cmd-tlm-api/app/models/streaming_thread.rb - About 1 hr to fix

                          Method generate_target has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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