AlbertGazizov/ioc_rb

View on GitHub

Showing 4 of 4 total issues

Method class_attribute has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def class_attribute(*attrs)
      options = attrs.extract_options!
      instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true)
      instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true)
      instance_predicate = options.fetch(:instance_predicate, true)
Severity: Minor
Found in lib/ext/vendored_activesupport.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 class_attribute has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def class_attribute(*attrs)
      options = attrs.extract_options!
      instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true)
      instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true)
      instance_predicate = options.fetch(:instance_predicate, true)
Severity: Minor
Found in lib/ext/vendored_activesupport.rb - About 1 hr to fix

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

      def create_bean_and_save(bean_metadata, beans_storage)
        if bean_metadata.bean_class.is_a?(Class)
          bean_class = bean_metadata.bean_class
        else
          bean_class = const_loader.load_const(bean_metadata.bean_class)
    Severity: Minor
    Found in lib/ioc_rb/bean_factory.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 inject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def inject(dependency_name, options = {})
          unless dependency_name.is_a?(Symbol)
            raise ArgumentError, "dependency name should be a symbol"
          end
          unless options.is_a?(Hash)
    Severity: Minor
    Found in lib/ioc_rb/inject.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