OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

Method update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def update(start:, stop:, kind:, data:, overlap: true)
      array = Store.zrangebyscore(@primary_key, @start, @start)
      if array.length == 0
        raise ActivityError.new "failed to find activity at: #{@start}"
      end
Severity: Minor
Found in openc3/lib/openc3/models/activity_model.rb - About 1 hr to fix

    Method move_log_file_to_bucket has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.move_log_file_to_bucket(filename, bucket_key, metadata: {})
          Thread.new do
            client = Bucket.getClient()
    
            orig_filename = nil
    Severity: Minor
    Found in openc3/lib/openc3/utilities/bucket_utilities.rb - About 1 hr to fix

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

          def read
            raise "Attempt to read from write only stream" unless @read_socket
      
            # No read mutex is needed because reads happen serially
            begin
      Severity: Minor
      Found in openc3/lib/openc3/streams/tcpip_socket_stream.rb - About 1 hr to fix

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

          def initialize(bucket_path)
            @bucket = OpenC3::Bucket.getClient()
            @bucket_path = bucket_path
            @local_path = nil
            @reservation_count = 0
        Severity: Minor
        Found in openc3/lib/openc3/utilities/bucket_file_cache.rb - About 1 hr to fix

          Method create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def create
              return unless authorization('script_run')
              if params['key'].nil? || params['value'].nil?
                render json: {
                  status: 'error',
          Severity: Minor
          Found in openc3-cosmos-cmd-tlm-api/app/controllers/environment_controller.rb - About 1 hr to fix

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

                    case 'WIDTH':
                      if (!isNaN(Number(setting[1]))) {
                        setting[1] += 'px'
                      }
                      style['width'] = setting[1] + ' !important'
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 115..120
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 121..126
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 146..151

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

            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 set_tlm(*args, type: :CONVERTED, manual: false, scope: $openc3_scope, token: $openc3_token)
                  target_name, packet_name, item_name, value = _set_tlm_process_args(args, __method__, scope: scope)
                  authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
                  CvtModel.set_item(target_name, packet_name, item_name, value, type: type.intern, scope: scope)
            Severity: Major
            Found in openc3/lib/openc3/api/tlm_api.rb and 1 other location - About 1 hr to fix
            openc3/lib/openc3/api/tlm_api.rb on lines 171..174

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

            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

                    case 'MARGIN':
                      if (!isNaN(Number(setting[1]))) {
                        setting[1] += 'px'
                      }
                      style['margin'] = setting[1] + ' !important'
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 115..120
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 140..145
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 146..151

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

            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

                    case 'PADDING':
                      if (!isNaN(Number(setting[1]))) {
                        setting[1] += 'px'
                      }
                      style['padding'] = setting[1] + ' !important'
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 121..126
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 140..145
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 146..151

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

            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 override_tlm(*args, type: :ALL, manual: false, scope: $openc3_scope, token: $openc3_token)
                  target_name, packet_name, item_name, value = _set_tlm_process_args(args, __method__, scope: scope)
                  authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
                  CvtModel.override(target_name, packet_name, item_name, value, type: type.intern, scope: scope)
            Severity: Major
            Found in openc3/lib/openc3/api/tlm_api.rb and 1 other location - About 1 hr to fix
            openc3/lib/openc3/api/tlm_api.rb on lines 110..113

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

            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

                    case 'HEIGHT':
                      if (!isNaN(Number(setting[1]))) {
                        setting[1] += 'px'
                      }
                      style['height'] = setting[1] + ' !important'
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 115..120
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 121..126
            openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/widgets/Widget.js on lines 140..145

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

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

            function addCopyArrows(acediff, info, diffIndex) {
              if (
                info.leftEndLine > info.leftStartLine &&
                acediff.options.left.copyLinkEnabled
              ) {

              Function __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def __init__(
                      self,
                      name: str,
                      folder_name: str = None,
                      cmd: Optional[list] = None,
              Severity: Minor
              Found in openc3/python/openc3/models/microservice_model.py - About 1 hr to fix

                Method cleanup has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def cleanup(areas, cleanup_poll_time)
                      bucket = Bucket.getClient()
                      while true
                        break if @cancel_thread
                
                
                Severity: Minor
                Found in openc3/lib/openc3/microservices/cleanup_microservice.rb - About 1 hr to fix

                  Method update_min_stats has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def update_min_stats(reduced, state)
                          # Update statistics for this packet's raw values
                          state.raw_values.each do |key, value|
                            if value
                              vals_key = "#{key}__VALS"
                  Severity: Minor
                  Found in openc3/lib/openc3/microservices/reducer_microservice.rb - About 1 hr to fix

                    Method values_and_limits_states has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def values_and_limits_states(item_array, value_types = :CONVERTED)
                            items = []
                    
                            # Verify item_array is a nested array
                            raise(ArgumentError, "item_array must be a nested array consisting of [[tgt,pkt,item],[tgt,pkt,item],...]") unless Array === item_array[0]
                    Severity: Minor
                    Found in openc3/lib/openc3/packets/telemetry.rb - About 1 hr to fix

                      Method download has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def self.download(target_name, scope:)
                            tmp_dir = Dir.mktmpdir
                            zip_filename = File.join(tmp_dir, "#{target_name}.zip")
                            Zip.continue_on_exists_proc = true
                            zip = Zip::File.open(zip_filename, Zip::File::CREATE)
                      Severity: Minor
                      Found in openc3/lib/openc3/models/target_model.rb - About 1 hr to fix

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

                            def connect
                              (@read_protocols | @write_protocols).each { |protocol| protocol.connect_reset }
                        
                              periodic_cmds = @options['PERIODIC_CMD']
                              if periodic_cmds
                        Severity: Minor
                        Found in openc3/lib/openc3/interfaces/interface.rb - About 1 hr to fix

                          Method identify has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def identify(packet_data, target_names = nil)
                                target_names = target_names() unless target_names
                          
                                target_names.each do |target_name|
                                  target_name = target_name.to_s.upcase
                          Severity: Minor
                          Found in openc3/lib/openc3/packets/telemetry.rb - About 1 hr to fix

                            Method get_metrics has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def get_metrics(manual: false, scope: $openc3_scope, token: $openc3_token)
                                  authorize(permission: 'system', manual: manual, scope: scope, token: token)
                            
                                  sum_metrics = SUM_METRICS.dup
                                  duration_metrics = DURATION_METRICS.dup
                            Severity: Minor
                            Found in openc3/lib/openc3/api/metrics_api.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language