Programatica/cow_proxy

View on GitHub

Showing 4 of 4 total issues

Method __wrapped_method__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def __wrapped_method__(inst_var, cow, method, *args, &block)
      __wrapped_value__(inst_var, method, *args, &block)
    rescue StandardError => e
      CowProxy.debug do
        "error #{e.message} on #{__getobj__.class.name} (#{__getobj__.object_id}) #{method} "\
Severity: Minor
Found in lib/cow_proxy/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 __wrapped_method__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __wrapped_method__(inst_var, cow, method, *args, &block)
Severity: Minor
Found in lib/cow_proxy/base.rb - About 35 mins to fix

    Method wrapping_block has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def wrapping_block(method, cow_enabled)
            lambda do |*args, &block|
              if method.to_s =~ /^\w+$/
                inst_var = "@#{method}"
                return _instance_variable_get(inst_var) if _instance_variable_defined?(inst_var)
    Severity: Minor
    Found in lib/cow_proxy/base.rb - About 35 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 __wrapped_value__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __wrapped_value__(inst_var, method, *args, &block)
          CowProxy.debug do
            "run on #{__getobj__.class.name} (#{__getobj__.object_id}) "\
            "#{method} #{args.inspect unless args.empty?}"
          end
    Severity: Minor
    Found in lib/cow_proxy/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

    Severity
    Category
    Status
    Source
    Language