OpenC3/cosmos

View on GitHub

Showing 842 of 1,379 total issues

Method spawn has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.spawn(scope, name, suite_runner = nil, disconnect = false, environment = nil, user_full_name = nil, username = nil)
    if File.extname(name) == '.py'
      process_name = 'python'
      runner_path = File.join(RAILS_ROOT, 'scripts', 'run_script.py')
    else
Severity: Major
Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 3 hrs to fix

    Function __init__ has 25 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in openc3/python/openc3/models/interface_model.py - About 3 hrs to fix

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

          def run
            RouterTopic.receive_telemetry(@router, scope: @scope) do |topic, msg_id, msg_hash, _redis|
              msgid_seconds_from_epoch = msg_id.split('-')[0].to_i / 1000.0
              delta = Time.now.to_f - msgid_seconds_from_epoch
              @metric.set(name: 'router_topic_delta_seconds', value: delta, type: 'gauge', unit: 'seconds', help: 'Delta time between data written to stream and router tlm start') if @metric
      Severity: Major
      Found in openc3/lib/openc3/microservices/interface_microservice.rb - About 3 hrs to fix

        Method build_suites has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.build_suites
              @@suites = []
              suites = {}
              groups = []
              ObjectSpace.each_object(Class) do |object|
        Severity: Major
        Found in openc3/lib/openc3/script/suite_runner.rb - About 3 hrs to fix

          Method process_request has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def process_request(request_data:, request_headers:, start_time:)
                @request_count += 1
                begin
                  request = JsonRpcRequest.from_json(request_data, request_headers)
                  response = nil
          Severity: Major
          Found in openc3/lib/openc3/io/json_drb.rb - About 3 hrs to fix

            Function parse_string has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              parse_string(
                input_string,
                original_filename,
                yield_non_keyword_lines,
                remove_quotes,
            Severity: Major
            Found in openc3/templates/tool_svelte/src/services/config-parser.js - About 3 hrs to fix

              Function match_bitap_ has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.match_bitap_ = function (text, pattern, loc) {
                if (pattern.length > this.Match_MaxBits) {
                  throw new Error('Pattern too long for this browser.')
                }
              
              

                Function parse_string has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  parse_string(
                    input_string,
                    original_filename,
                    yield_non_keyword_lines,
                    remove_quotes,

                  Method run_text has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def run_text(text,
                                 line_offset = 0,
                                 text_binding = nil,
                                 close_on_complete = false,
                                 initial_filename: nil)
                  Severity: Major
                  Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 3 hrs to fix

                    Method build_page has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def build_page(meta, page)
                        modifiers = {}
                        meta.each do |keyword, data|
                          page << "\n#{'#' * @level} #{keyword}\n"
                          if data['since']
                    Severity: Major
                    Found in docs.openc3.com/scripts/generate_docs_from_yaml.rb - About 2 hrs to fix

                      Method check_tool_base has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def check_tool_base(path, base_pkgs)
                        Dir.chdir(path) do
                          # List the remote tags and sort reverse order (latest on top)
                          # Pipe to sed to get the second line because the output looks like:
                          #   6b7bfd3c201c1185129e819e02dc2505dbb82994    refs/tags/v7.0.96^{}
                      Severity: Major
                      Found in scripts/release/package_audit_lib.rb - About 2 hrs to fix

                        Function decodeURI has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        diff_match_patch.prototype.decodeURI = function (text) {
                          try {
                            return decodeURI(text)
                          } catch (e) {
                            var i = 0

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

                              def to_config(cmd_or_tlm)
                                config = ''
                          
                                if cmd_or_tlm == :TELEMETRY
                                  config << "TELEMETRY #{@target_name.to_s.quote_if_necessary} #{@packet_name.to_s.quote_if_necessary} #{@default_endianness} \"#{@description}\"\n"
                          Severity: Major
                          Found in openc3/lib/openc3/packets/packet.rb - About 2 hrs to fix

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

                                def to_config(cmd_or_tlm, default_endianness)
                                  config = ''
                                  if cmd_or_tlm == :TELEMETRY
                                    if self.array_size
                                      config << "  ARRAY_ITEM #{self.name.to_s.quote_if_necessary} #{self.bit_offset} #{self.bit_size} #{self.data_type} #{self.array_size} \"#{self.description.to_s.gsub("\"", "'")}\""
                            Severity: Major
                            Found in openc3/lib/openc3/packets/packet_item.rb - About 2 hrs to fix

                              Method get_packet_index has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def get_packet_index(cmd_or_tlm, target_name, packet_name, entry_type, data)
                                    if cmd_or_tlm == :CMD
                                      target_table = @cmd_packet_table[target_name]
                                    else
                                      target_table = @tlm_packet_table[target_name]
                              Severity: Major
                              Found in openc3/lib/openc3/logs/packet_log_writer.rb - About 2 hrs to fix

                                Method write has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def write(packet)
                                      name = packet.packet_name.upcase
                                
                                      hs_packet = @tlm_packets['HEALTH_STATUS']
                                      params_packet = @tlm_packets['PARAMS']

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

                                      def as_json(*a)
                                        config = {}
                                        config['name'] = self.name
                                        config['bit_offset'] = self.bit_offset
                                        config['bit_size'] = self.bit_size
                                  Severity: Major
                                  Found in openc3/lib/openc3/packets/packet_item.rb - About 2 hrs to fix

                                    Method _cmd_implementation has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def _cmd_implementation(method_name, *args, range_check:, hazardous_check:, raw:, timeout: nil, log_message: nil, manual: false, validate: true,
                                                                scope: $openc3_scope, token: $openc3_token, **kwargs)
                                          extract_string_kwargs_to_args(args, kwargs)
                                          unless [nil, true, false].include?(log_message)
                                            raise "Invalid log_message parameter: #{log_message}. Must be true or false."
                                    Severity: Major
                                    Found in openc3/lib/openc3/api/cmd_api.rb - About 2 hrs to fix

                                      Function computeDiff has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function computeDiff(acediff, diffType, offsetLeft, offsetRight, diffText) {
                                        let lineInfo = {}
                                      
                                        if (diffType === C.DIFF_INSERT) {
                                          // pretty confident this returns the right stuff for the left editor: start & end line & char

                                        Method identify_and_finish_packet has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            def identify_and_finish_packet
                                              packet_data = nil
                                              identified_packet = nil
                                        
                                              if @telemetry
                                        Severity: Major
                                        Found in openc3/lib/openc3/interfaces/protocols/fixed_protocol.rb - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language