am-kantox/kungfuig

View on GitHub

Showing 9 of 42 total issues

Method hook has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def hook
      status = {}
      λ = (hash = to_hash).delete(:lambdas)

      p = Module.new do
Severity: Minor
Found in lib/kungfuig/prepender.rb - About 5 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 hook has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def hook
      status = {}
      λ = (hash = to_hash).delete(:lambdas)

      p = Module.new do
Severity: Minor
Found in lib/kungfuig/prepender.rb - About 1 hr to fix

    Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize *args, **params
          @λ = { before: nil, after: nil, on_hook: nil, on_error: nil }
          @klazz, @method, @receiver =  case args.size
                                        when 1
                                          case args.first
    Severity: Minor
    Found in lib/kungfuig/prepender.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 bottleneck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def bottleneck(method: nil, receiver: nil, result: nil, **params)
            return unless (receiver_class = receiver.class.ancestors.detect do |c|
              @hash[c.name] && @hash[c.name][method]
            end)
    
    
    Severity: Minor
    Found in lib/kungfuig/jobber.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 attach has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def attach(to, before: nil, after: nil, exclude: nil)
          fail ArgumentError, "Trying to attach nothing to #{klazz}##{to}. I need a block!" unless block_given?
    
          cb = Proc.new
    
    
    Severity: Minor
    Found in lib/kungfuig/aspector.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 load_stuff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def load_stuff hos
        case hos
        when NilClass then Hashie::Mash.new # aka skip
        when Hash then Hashie::Mash.new(hos)
        when String
    Severity: Minor
    Found in lib/kungfuig.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 bulk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def bulk(hos)
          Kungfuig.load_stuff(hos).map do |klazz, hash|
            next if hash.empty?
            [klazz, H.new.remap_hash_for_easy_iteration(hash).map do |handler, methods|
              begin
    Severity: Minor
    Found in lib/kungfuig/aspector.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 aspect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def aspect meth, after = true
          fail ArgumentError.new "Aspect must have a codeblock" unless block_given?
          fail NoMethodError.new "Aspect must be attached to existing method" unless instance_methods.include? meth.to_sym
    
          Kungfuig::Prepender.new(self, meth).public_send((after ? :after : :before), &Proc.new).hook!
    Severity: Minor
    Found in lib/kungfuig.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 option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def option *keys
          key = keys.map(&:to_s).join('.').gsub(/::/, '.').split('.')
    
          MX.synchronize {
            # options.foo!.bar!.baz!
    Severity: Minor
    Found in lib/kungfuig.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