BallAerospace/COSMOS

View on GitHub

Showing 938 of 938 total issues

Method read has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def read(count_100hz, time)
      pending_packets = get_pending_packets(count_100hz)

      pending_packets.each do |packet|
        case packet.packet_name

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 set_min_max_default has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def set_min_max_default(item, type, data_type)
      return unless @current_cmd_or_tlm == PacketConfig::COMMAND

      # Need to set min, max, and default
      if data_type == :INT || data_type == :UINT
Severity: Minor
Found in cosmos/lib/cosmos/packets/parsers/xtce_parser.rb - About 6 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_object_types has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def get_object_types(element)
      array_type = nil
      if /Parameter/.match?(element.name)
        # Look up the parameter and parameter type
        parameter = @parameters[element['parameterRef']]
Severity: Minor
Found in cosmos/lib/cosmos/packets/parsers/xtce_parser.rb - About 5 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 identify_and_finish_packet has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def identify_and_finish_packet
      packet_data = nil
      identified_packet = nil

      @interface.target_names.each do |target_name|
Severity: Minor
Found in cosmos/lib/cosmos/interfaces/protocols/fixed_protocol.rb - About 5 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 auto_detect_gem_based_targets has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def auto_detect_gem_based_targets
      Bundler.load.specs.each do |spec|
        spec_name_split = spec.name.split('-')
        if spec_name_split.length > 1 && (spec_name_split[0] == 'cosmos')
          # search for multiple targets packaged in a single gem
Severity: Minor
Found in cosmos/lib/cosmos/system/system_config.rb - About 5 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 process_result has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def process_result(results)
      cosmos_lib = Regexp.new(File.join(Cosmos::PATH, 'lib'))
      # If we were passed an array we concat it to the results global
      if results.is_a? Array
        @results.concat(results)
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_results.rb - About 5 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 overall_limits_state has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def overall_limits_state(ignored_items = nil)
      overall = :GREEN
      limits_packet_stale = false
      items_out_of_limits = []
      # Note: If anything with limits is stale then overall limits state cannot be green or blue
Severity: Minor
Found in cosmos/lib/cosmos/packets/limits.rb - About 5 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 define has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def define(item)
      # Handle Overwriting Existing Item
      if @items[item.name]
        item_index = nil
        @sorted_items.each_with_index do |sorted_item, index|
Severity: Minor
Found in cosmos/lib/cosmos/packets/structure.rb - About 5 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 run_method has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def run_method(object, method_name)
      # Convert to a symbol to use as a method_name
      method_name = method_name.to_s.intern unless method_name.class == Symbol

      result = ScriptResult.new
Severity: Minor
Found in cosmos/lib/cosmos/script/suite.rb - About 5 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 as_json has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def as_json
      config = {}
      config['name'] = self.name
      config['bit_offset'] = self.bit_offset
      config['bit_size'] = self.bit_size
Severity: Minor
Found in cosmos/lib/cosmos/packets/packet_item.rb - About 5 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 build_cmd_output_string has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def build_cmd_output_string(target_name, cmd_name, cmd_params, raw = false)
      if raw
        output_string = 'cmd_raw("'
      else
        output_string = 'cmd("'
Severity: Minor
Found in cosmos/lib/cosmos/packets/commands.rb - About 4 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 reduce_to_single_packet has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def reduce_to_single_packet
      # Discard sync pattern if present
      if @sync_pattern
        if @reduction_state == :START
          return :STOP if @data.length < @sync_pattern.length
Severity: Minor
Found in cosmos/lib/cosmos/interfaces/protocols/preidentified_protocol.rb - About 4 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 fast_select has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def fast_select(read_sockets = nil, write_sockets = nil, error_array = nil, timeout = nil)
      # Always try a zero timeout first
      current_timeout = SELECT_BASE_TIMEOUT
      total_timeout = 0.0

Severity: Minor
Found in cosmos/lib/cosmos/core_ext/io.rb - About 4 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_entry has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def write_entry(entry_type, cmd_or_tlm, target_name, packet_name, time_nsec_since_epoch, stored, data, id)
      raise ArgumentError.new("Length of id must be 64, got #{id.length}") if id and id.length != 64 # 64 hex digits, gets packed to 32 bytes with .pack('H*')

      length = COSMOS5_PRIMARY_FIXED_SIZE
      flags = 0
Severity: Minor
Found in cosmos/lib/cosmos/logs/packet_log_writer.rb - About 4 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 process_file has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def process_file(filename)
      Logger.instance.info "Processing target definition in file '#{filename}'"
      parser = ConfigParser.new("https://ballaerospace.github.io/cosmos-website/docs/v5/target")
      parser.parse_file(filename) do |keyword, parameters|
        case keyword
Severity: Minor
Found in cosmos/lib/cosmos/system/target.rb - About 4 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 32 (exceeds 5 allowed). Consider refactoring.
Open

  def self.all(scope, target)
    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/screen.rb - About 4 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_limits_values has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_limits_values(item, value, limits_set, ignore_persistence)
      # Retrieve limits settings for the specified limits_set
      limits = item.limits.values[limits_set]

      # Use the default limits set if limits aren't specified for the
Severity: Minor
Found in cosmos/lib/cosmos/packets/packet.rb - About 4 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 build_cmd_output_string has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def build_cmd_output_string(target_name, cmd_name, cmd_params, packet, raw)
      if raw
        output_string = 'cmd_raw("'
      else
        output_string = 'cmd("'
Severity: Minor
Found in cosmos/lib/cosmos/api/cmd_api.rb - About 4 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 extract_fields_from_cmd_text has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_fields_from_cmd_text(text, scope: $cosmos_scope)
      split_string = text.split(/\s+with\s+/i, 2)
      raise "ERROR: text must not be empty" if split_string.length == 0
      raise "ERROR: 'with' must be followed by parameters : #{text}" if (split_string.length == 1 and text =~ /\s*with\s*/i) or (split_string.length == 2 and split_string[1].empty?)

Severity: Minor
Found in cosmos/lib/cosmos/script/extract.rb - About 4 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_sync_pattern has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_sync_pattern
      if @sync_pattern and @sync_state == :SEARCHING
        loop do
          # Make sure we have some data to look for a sync word in
          return :STOP if @data.length < @sync_pattern.length
Severity: Minor
Found in cosmos/lib/cosmos/interfaces/protocols/burst_protocol.rb - About 4 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