BallAerospace/COSMOS

View on GitHub

Showing 688 of 938 total issues

Method resize_buffer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def resize_buffer
        if @buffer
          # Extend data size
          if @buffer.length < @defined_length
            @buffer << (ZERO_STRING * (@defined_length - @buffer.length))
Severity: Minor
Found in cosmos/lib/cosmos/packets/structure.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(write_port_name,
                   read_port_name,
                   baud_rate,
                   parity,
                   stop_bits,
Severity: Minor
Found in cosmos/lib/cosmos/interfaces/serial_interface.rb - About 25 mins 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_remote_handshake has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_remote_handshake(linc_handshake)
      # This is a remote packet (sent from here).
      # Add to the array of handshake packet responses
      # The mutex is required by the command task due to the way it
      # first looks up the handshake before removing it.
Severity: Minor
Found in cosmos/lib/cosmos/interfaces/linc_interface.rb - About 25 mins 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 yds2mdy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.yds2mdy(year, day, sec)
    # Convert day of year (1-366) to day of month (1-31)
    if self.leap_year?(year)
      array = Time::LeapYearMonthDays
    else
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/time.rb - About 25 mins 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 respawn_changed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def respawn_changed
      @mutex.synchronize do
        if @changed_processes.length > 0
          Logger.info("Cycling #{@changed_processes.length} changed microservices...")
          shutdown_processes(@changed_processes)
Severity: Minor
Found in cosmos/lib/cosmos/operators/operator.rb - About 25 mins 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 leap_year? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.leap_year?(year)
    return_value = false

    if (year % 4) == 0
      return_value = true
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/time.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def deploy(gem_path, variables, validate_only: false)
      # Ensure tools bucket exists
      Cosmos::S3Utilities.ensure_public_bucket('tools') unless validate_only

      filename = gem_path + "/tools/widgets/" + @full_name + '/' + @filename
Severity: Minor
Found in cosmos/lib/cosmos/models/widget_model.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def write(time_nsec_since_epoch, data, redis_offset)
      return if !@logging_enabled

      @mutex.synchronize do
        prepare_write(time_nsec_since_epoch, data.length, redis_offset)
Severity: Minor
Found in cosmos/lib/cosmos/logs/text_log_writer.rb - About 25 mins 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 formatted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def formatted(include_year = true, fractional_digits = 3, include_utc_offset = false)
    str =  ""
    str << "%Y/%m/%d " if include_year
    str << "%H:%M:%S"
    str << ".%#{fractional_digits}N" if fractional_digits > 0
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/time.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(name, endianness, type, description, filename)
      super(TARGET, name, endianness, description, '', TableItem)
      # ONE_DIMENSIONAL and TWO_DIMENSIONAL are deprecated so translate
      type = :KEY_VALUE if type == :ONE_DIMENSIONAL
      type = :ROW_COLUMN if type == :TWO_DIMENSIONAL
Severity: Minor
Found in cosmos/lib/cosmos/tools/table_manager/table.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize
      Logger.level = Logger::INFO
      # TODO: This is pretty generic. Can we pass in more information to help identify the operator?
      Logger.microservice_name = 'MicroserviceOperator'
      Logger.tag = "operator.log"
Severity: Minor
Found in cosmos/lib/cosmos/operators/operator.rb - About 25 mins 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 julian2mdy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.julian2mdy(jdate)
    z = (jdate + 0.5).to_i
    w = ((z - 1867216.25) / 36524.25).to_i
    x = w / 4
    a = z + 1 + w - x
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/time.rb - About 25 mins 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 create_table_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_table_item(table)
      name = @parser.parameters[0]
      if table.type == :ROW_COLUMN
        name = "#{name}0"
        table.num_columns += 1
Severity: Minor
Found in cosmos/lib/cosmos/tools/table_manager/table_item_parser.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def write(entry_type, cmd_or_tlm, target_name, packet_name, time_nsec_since_epoch, stored, data, id = nil, redis_offset = '0-0')
      return if !@logging_enabled

      @mutex.synchronize do
        prepare_write(time_nsec_since_epoch, data.length, redis_offset)
Severity: Minor
Found in cosmos/lib/cosmos/logs/packet_log_writer.rb - About 25 mins 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 is_ascii? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.is_ascii?(filename)
    return_value = true
    File.open(filename) do |file|
      while buf = file.read(1024)
        if NON_ASCII_PRINTABLE.match?(buf)
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/file.rb - About 25 mins 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 min_with_index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def min_with_index
      minimum = nil
      minimum_index = nil

      if self.length > 0
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/array.rb - About 25 mins 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_limits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_limits(target_name, packet_name, item_name, scope: $cosmos_scope, token: $cosmos_token)
      authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
      limits = {}
      item = TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)
      item['limits'].each do |key, vals|
Severity: Minor
Found in cosmos/lib/cosmos/api/limits_api.rb - About 25 mins 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 max_with_index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def max_with_index
      maximum = nil
      maximum_index = nil

      if self.length > 0
Severity: Minor
Found in cosmos/lib/cosmos/core_ext/array.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(poly, seed, xor, reflect)
      @poly = poly
      @seed = seed
      @xor = xor
      @reflect = reflect
Severity: Minor
Found in cosmos/lib/cosmos/utilities/crc.rb - About 25 mins 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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def stop(take_mutex = true, s3_object_metadata: {})
      @mutex.lock if take_mutex
      if @file and not @file.closed?
        @file.close
        File.chmod(0444, @filename)
Severity: Minor
Found in cosmos/lib/cosmos/utilities/message_log.rb - About 25 mins 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