ddd-ruby/smart_ioc

View on GitHub

Showing 8 of 8 total issues

Method autodetect_bean_definition has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def autodetect_bean_definition(bean, package, parent_bean_package)
    if package
      bean_context = @extra_package_contexts.get_context(package)
      bds = @bean_definitions_storage.filter_by_with_drop_to_default_context(bean, package, bean_context)

Severity: Minor
Found in lib/smart_ioc/bean_factory.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 register_bean has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def register_bean(bean_name:, klass:, context:, scope:, path:,
                      factory_method: nil, package_name: nil, instance: true)
      context ||= DEFAULT_CONTEXT

      check_arg(bean_name, :bean_name, Symbol)
Severity: Minor
Found in lib/smart_ioc/container.rb - About 1 hr to fix

    Method autodetect_bean_definition has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def autodetect_bean_definition(bean, package, parent_bean_package)
        if package
          bean_context = @extra_package_contexts.get_context(package)
          bds = @bean_definitions_storage.filter_by_with_drop_to_default_context(bean, package, bean_context)
    
    
    Severity: Minor
    Found in lib/smart_ioc/bean_factory.rb - About 1 hr to fix

      Method bean has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def bean(bean_name, scope: nil, package: nil, instance: true, factory_method: nil, context: nil)
            file_path = caller[0].split(':').first
      
            bean_definition = SmartIoC.get_bean_definition_by_class(self)
      
      
      Severity: Minor
      Found in lib/smart_ioc/iocify.rb - About 1 hr to fix

        Method update_dependencies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_dependencies(bean, bean_definition, updated_beans = {})
            bean_definition.dependencies.each do |dependency|
              bd = autodetect_bean_definition(
                dependency.ref, dependency.package, bean_definition.package
              )
        Severity: Minor
        Found in lib/smart_ioc/bean_factory.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 get_cross_refference has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_cross_refference(refer_bean_definitions, current_bean_definition, seen_bean_definitions = [])
            current_bean_definition.dependencies.each do |dependency|
              bd = dependency.bean_definition
        
              next if seen_bean_definitions.include?(bd)
        Severity: Minor
        Found in lib/smart_ioc/bean_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 register_bean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def register_bean(bean_name:, klass:, context:, scope:, path:,
                              factory_method: nil, package_name: nil, instance: true)
              context ||= DEFAULT_CONTEXT
        
              check_arg(bean_name, :bean_name, Symbol)
        Severity: Minor
        Found in lib/smart_ioc/container.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 preload_beans has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def preload_beans(bean_definition, beans_cache)
            scope = get_scope(bean_definition)
        
            if scope_bean = scope.get_bean(bean_definition.klass)
              beans_cache[:scope_bean] = scope_bean
        Severity: Minor
        Found in lib/smart_ioc/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

        Severity
        Category
        Status
        Source
        Language