taichi-ishitani/rggen

View on GitHub
lib/rggen/builtins/register/type.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method check_array_demension has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def check_array_demension
        return unless register.array?
        return if register.dimensions.size == 1
        return if array_options[:support_multiple_dimensions]
        error 'multiple dimensions array register is not allowed'
Severity: Minor
Found in lib/rggen/builtins/register/type.rb - About 1 hr 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 select_target_item has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def select_target_item(cell)
        @target_items.fetch(cell.value.type) do
          next if cell.value.type == :default
          error "unknown register type: #{cell.value.type}", cell
        end unless cell.empty?
Severity: Minor
Found in lib/rggen/builtins/register/type.rb - About 1 hr 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_array_register_usage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def check_array_register_usage
        return unless register.array?
        return if support_array_register?
        error 'array register is not allowed'
      end
Severity: Minor
Found in lib/rggen/builtins/register/type.rb - About 55 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 check_byte_size has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def check_byte_size
        return if required_byte_size == :any_size
        return if register.byte_size == required_byte_size_value
        error "byte size(#{register.byte_size}) is not matched with " \
              "required size(#{required_byte_size_value})"
Severity: Minor
Found in lib/rggen/builtins/register/type.rb - About 45 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 address_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def address_code(address)
        base  = hex(address, local_address_width)
        if register.array? && register.multiple?
          increment_value = hex(byte_width, local_address_width)
          "#{base} + #{increment_value} * #{local_index}"
Severity: Minor
Found in lib/rggen/builtins/register/type.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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def convert(cell)
        [:default, *@target_items.keys].find_yield do |t|
          case cell
          when /\A#{t}(?::(.+))?\Z/im
            cell_value.new(t, Regexp.last_match.captures[0])
Severity: Minor
Found in lib/rggen/builtins/register/type.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

There are no issues that match your filters.

Category
Status