Charyf/charyf-core

View on GitHub
lib/charyf/utils/generator/base.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Class Base has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base < Thor::Group
      include Thor::Actions
      include Charyf::Generators::Actions

      add_runtime_options!
Severity: Minor
Found in lib/charyf/utils/generator/base.rb - About 2 hrs to fix

    Method hook_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.hook_for(*names, &block)
            options = names.last.is_a?(Hash) ? names.pop : {}
            in_base = options.delete(:in) || base_name
            as_hook = options.delete(:as) || generator_name
    
    
    Severity: Minor
    Found in lib/charyf/utils/generator/base.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 prepare_for_invocation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.prepare_for_invocation(name, value) #:nodoc:
            return super unless value.is_a?(String) || value.is_a?(Symbol) #|| value.is_a?(Array)
    
            if value && constants = hooks[name]
              value = name if TrueClass === value
    Severity: Minor
    Found in lib/charyf/utils/generator/base.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 class_collisions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def class_collisions(*class_names)
            return unless behavior == :invoke
    
            class_names.flatten.each do |class_name|
              class_name = class_name.to_s
    Severity: Minor
    Found in lib/charyf/utils/generator/base.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 default_source_root has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.default_source_root
            return unless base_name && generator_name
            return unless default_generator_root
            path = File.join(default_generator_root, "templates")
            path if File.exist?(path)
    Severity: Minor
    Found in lib/charyf/utils/generator/base.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 _invoke_for_class_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def _invoke_for_class_method(klass, command = nil, *args, &block) #:nodoc:
            with_padding do
              if block
                case block.arity
                  when 3
    Severity: Minor
    Found in lib/charyf/utils/generator/base.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