BallAerospace/COSMOS

View on GitHub

Showing 688 of 938 total issues

Method get_cmd_time has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def get_cmd_time(target_name = nil, command_name = nil, scope: $cosmos_scope, token: $cosmos_token)
      authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
      if target_name and command_name
        time = CommandDecomTopic.get_cmd_item(target_name, command_name, 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
        [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
Severity: Minor
Found in cosmos/lib/cosmos/api/cmd_api.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method write has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def write(data)
      if @logging_enabled
        return if !data or data.length <= 0

        need_new_file = false
Severity: Minor
Found in cosmos/lib/cosmos/io/raw_logger.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Consider simplifying this complex logical expression.
Open

              if instance.logging_enabled and
                (
                  # Cycle based on total time logging
                  (instance.cycle_time and (utc_now - instance.start_time) > instance.cycle_time) or

Severity: Critical
Found in cosmos/lib/cosmos/logs/log_writer.rb - About 2 hrs to fix

    Method _cmd_string has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def _cmd_string(target_name, cmd_name, cmd_params, raw)
          output_string = $disconnect ? 'DISCONNECT: ' : ''
          if raw
            output_string += 'cmd_raw("'
          else
    Severity: Minor
    Found in cosmos/lib/cosmos/script/commands.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method wait_check_tolerance has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def wait_check_tolerance(*args, type: :CONVERTED, scope: $cosmos_scope, token: $cosmos_token, &block)
          raise "Invalid type '#{type}' for wait_check_tolerance" unless %i(RAW CONVERTED).include?(type)
    
          target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = _wait_tolerance_process_args(args, scope: scope, token: token)
          start_time = Time.now.sys
    Severity: Minor
    Found in cosmos/lib/cosmos/script/api_shared.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method check_tolerance has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_tolerance(*args, type: :CONVERTED, scope: $cosmos_scope, token: $cosmos_token)
          raise "Invalid type '#{type}' for check_tolerance" unless %i(RAW CONVERTED).include?(type)
    
          target_name, packet_name, item_name, expected_value, tolerance =
            _check_tolerance_process_args(args, scope: scope, token: token)
    Severity: Minor
    Found in cosmos/lib/cosmos/script/api_shared.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method xtce_handle_base_container has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def xtce_handle_base_container(base_name, element)
          if element.name == base_name
            # Need to add BaseContainer items to current_packet
            # Lookup the base packet
            if base_name == 'BaseMetaCommand'
    Severity: Minor
    Found in cosmos/lib/cosmos/packets/parsers/xtce_parser.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method listen_thread_body has a Cognitive Complexity of 19 (exceeds 5 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 cosmos/lib/cosmos/interfaces/tcpip_server_interface.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(
          hostname,
          write_dest_port,
          read_port,
          write_src_port = nil,
    Severity: Minor
    Found in cosmos/lib/cosmos/interfaces/udp_interface.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method start_listen_thread has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def start_listen_thread(port, listen_write = false, listen_read = false)
          # Create a socket to accept connections from clients
          addr = Socket.pack_sockaddr_in(port, @listen_address)
          if RUBY_ENGINE == 'ruby'
            listen_socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
    Severity: Minor
    Found in cosmos/lib/cosmos/interfaces/tcpip_server_interface.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method post_write_interface has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def post_write_interface(packet, data)
          if @response_template && @response_packet
            if @response_timeout
              response_timeout_time = Time.now + @response_timeout
            else
    Severity: Minor
    Found in cosmos/lib/cosmos/interfaces/protocols/template_protocol.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method handle_config has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_config(parser, keyword, parameters)
          case keyword
          when 'CMD_LOG_CYCLE_TIME'
            parser.verify_num_parameters(1, 1, "#{keyword} <Maximum time between files in seconds>")
            @cmd_log_cycle_time = parameters[0].to_i
    Severity: Minor
    Found in cosmos/lib/cosmos/models/target_model.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method _limits_group has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def _limits_group(group_name, action:, scope:, token:)
          authorize(permission: 'tlm_set', scope: scope, token: token)
          group_name.upcase!
          group = get_limits_groups()[group_name]
          raise "LIMITS_GROUP #{group_name} undefined. Ensure your telemetry definition contains the line: LIMITS_GROUP #{group_name}" unless group
    Severity: Minor
    Found in cosmos/lib/cosmos/api/limits_api.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method deploy has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def deploy(gem_path, variables, validate_only: false)
          rubys3_client = Aws::S3::Client.new
          variables["target_name"] = @name
          start_path = "/targets/#{@folder_name}/"
          temp_dir = Dir.mktmpdir
    Severity: Minor
    Found in cosmos/lib/cosmos/models/target_model.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method list_files_before_time has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.list_files_before_time(bucket, prefix, time)
          rubys3_client = Aws::S3::Client.new
          oldest_list = []
          total_size = 0
    
    
    Severity: Minor
    Found in cosmos/lib/cosmos/utilities/s3.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method next_bit_offset has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.next_bit_offset(item)
          if item.array_size
            if item.array_size > 0
              next_offset = item.bit_offset + item.array_size
            else
    Severity: Minor
    Found in cosmos/lib/cosmos/packets/packet.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method all has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.all(scope)
        rubys3_client = Aws::S3::Client.new
        resp = rubys3_client.list_objects_v2(bucket: DEFAULT_BUCKET_NAME)
        result = []
        modified = []
    Severity: Minor
    Found in cosmos-script-runner-api/app/models/script.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method start has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.start(suite_class, group_class = nil, script = nil)
          result = []
          execute('', suite_class, group_class, script) do |suite|
            if script
              result = suite.run_script(group_class, script)
    Severity: Minor
    Found in cosmos/lib/cosmos/script/suite_runner.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method all has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.all(scope)
        rubys3_client = Aws::S3::Client.new
        resp = rubys3_client.list_objects_v2(bucket: DEFAULT_BUCKET_NAME)
        result = []
        modified = []
    Severity: Minor
    Found in cosmos-cmd-tlm-api/app/models/table.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method get_cmd_item has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.get_cmd_item(target_name, packet_name, param_name, type: :WITH_UNITS, scope: $cosmos_scope)
          msg_id, msg_hash = Topic.get_newest_message("#{scope}__DECOMCMD__{#{target_name}}__#{packet_name}")
          if msg_id
            # TODO: We now have these reserved items directly on command packets
            # Do we still calculate from msg_hash['time'] or use the times directly?
    Severity: Minor
    Found in cosmos/lib/cosmos/topics/command_decom_topic.rb - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language