taichi-ishitani/rggen

View on GitHub

Showing 33 of 40 total issues

Method required_refercne_not_exist? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def required_refercne_not_exist?
        return false unless use_reference?
        return false unless reference_options[:required]
        return false if bit_field.has_reference?
        true
Severity: Minor
Found in lib/rggen/builtins/bit_field/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_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 overlap_indirect_indexes? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def overlap_indirect_indexes?(previous_register)
      return false unless overlap_address_range?(register, previous_register)
      return true  unless unique_shadw_indexes?(register, previous_register)
      return true  unless unique_shadw_indexes?(previous_register, register)
      false
Severity: Minor
Found in lib/rggen/builtins/register/uniqueness_validator.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 reference_width_mismatch? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def reference_width_mismatch?
        return false unless use_reference?
        return false unless bit_field.has_reference?
        bit_field.reference.width != required_reference_width
      end
Severity: Minor
Found in lib/rggen/builtins/bit_field/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 width_mismatch? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def width_mismatch?
        return false if required_width.nil?
        if required_width.respond_to?(:include?)
          required_width.not.include?(bit_field.width)
        else
Severity: Minor
Found in lib/rggen/builtins/bit_field/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 required_reference_width has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def required_reference_width
        return 1 unless reference_options[:width]
        return bit_field.width if reference_options[:width] == same_width
        reference_options[:width]
      end
Severity: Minor
Found in lib/rggen/builtins/bit_field/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 define_rggen_class has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def define_rggen_class(base_class, options, body)
        if options.key?(:include) || body
          Class.new(base_class) do
            include(*Array(options[:include])) if options.key?(:include)
            class_exec(&body) if body
Severity: Minor
Found in lib/rggen/builder/component_entry.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 description has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def description(value = nil)
        if value
          @description  = value
        elsif @description || @default
          ''.tap do |d|
Severity: Minor
Found in lib/rggen/options.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_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 parse_address has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_address(cell)
      if pattern_matched?
        addresses = captures.compact.map(&method(:Integer))
        if addresses.size == 2
          addresses
Severity: Minor
Found in lib/rggen/builtins/register/offset_address.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 == has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def ==(other)
        return false unless name == other.name
        return true if [value, other.value].any?(&:nil?)
        value == other.value
      end
Severity: Minor
Found in lib/rggen/builtins/register/types/indirect.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 enable_item_entries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def enable_item_entries(entry_name_or_names)
        Array(entry_name_or_names).each do |entry_name|
          next if @enabled_entries.include?(entry_name)
          next unless @simple_item_entries.key?(entry_name) ||
                      @list_item_entries.key?(entry_name)
Severity: Minor
Found in lib/rggen/builder/item_store.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 required_width has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def required_width
        width = self.class.required_width
        return nil if width.nil?
        return configuration.data_width if width == full_width
        width
Severity: Minor
Found in lib/rggen/builtins/bit_field/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 loop_variable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def loop_variable(level)
      return nil unless array?
      return nil if level >= dimensions.size
      @loop_variables ||= Hash.new do |h, l|
        h[l]  = create_identifier("g_#{loop_index(l)}")
Severity: Minor
Found in lib/rggen/builtins/register/rtl_top.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 create_new_entry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def create_new_entry(associated_category, body)
        ComponentEntry.new.tap do |new_entry|
          new_entry.instance_exec(&body)
          @builder.categories.each do |name, category|
            next if associated_category && name != associated_category
Severity: Minor
Found in lib/rggen/builder/component_store.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 not_aligned_with_data_width? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def not_aligned_with_data_width?
      byte_width  = configuration.byte_width
      return true unless (@start_address + 0).multiple?(byte_width)
      return true unless (@end_address   + 1).multiple?(byte_width)
      false
Severity: Minor
Found in lib/rggen/builtins/register_block/base_address.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def create(*args)
        parent  = (child_factory? && args.shift) || nil
        sources = args
        create_component(parent, *sources).tap do |component|
          create_items(component, *sources) if create_items?
Severity: Minor
Found in lib/rggen/base/component_factory.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 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 parse_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_address(cell)
      if pattern_matched?
        @start_address        = Integer(captures[0])
        @end_address          = Integer(captures[1])
        @byte_size            = @end_address - @start_address + 1
Severity: Minor
Found in lib/rggen/builtins/register_block/base_address.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

Severity
Category
Status
Source
Language