influencemapping/whos_got_dirt-gem

View on GitHub

Showing 8 of 15 total issues

Method walk has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def walk(node, data)
      case node
      when Hash
        hash = {}
        node.each do |key,value|
Severity: Minor
Found in lib/whos_got_dirt/renderer.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 all_of has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def all_of(target, source, opts = {})
      params = parameters(opts)

      if params[source]
        equal(target, source, opts)
Severity: Minor
Found in lib/whos_got_dirt/request.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 convert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def convert
          match('company_name', 'name')
          equal('limit', 'limit') # default 100
          equal('index', 'page', transform: lambda{|v| (Integer(v) - 1) * (Integer(input['limit'] || 100))})

Severity: Minor
Found in lib/whos_got_dirt/requests/entity/corp_watch.rb - About 1 hr to fix

    Method walk has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def walk(node, data)
          case node
          when Hash
            hash = {}
            node.each do |key,value|
    Severity: Minor
    Found in lib/whos_got_dirt/renderer.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

            elsif params["#{source}>="] || params["#{source}>"] || params["#{source}<="] || params["#{source}<"]
              output[target] = "#{params["#{source}>="] || params["#{source}>"]}:#{params["#{source}<="] || params["#{source}<"]}"
      Severity: Major
      Found in lib/whos_got_dirt/request.rb - About 40 mins to fix

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

                def convert
                  match('company_name', 'name')
                  equal('limit', 'limit') # default 100
                  equal('index', 'page', transform: lambda{|v| (Integer(v) - 1) * (Integer(input['limit'] || 100))})
        
        
        Severity: Minor
        Found in lib/whos_got_dirt/requests/entity/corp_watch.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 validate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate!(opts = {})
              # The code assumes that processing errors in reverse avoids re-indexing
              # issues when deleting items from arrays. If this assumption is invalid,
              # we can delete items one at a time and re-validate using this skeleton:
              #
        Severity: Minor
        Found in lib/whos_got_dirt/result.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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def convert
                  equal('per_page', 'limit', default: input['open_corporates_api_key'] && 100) # default 30, maximum 100
                  equal('page', 'page')
        
                  input['subject'] && input['subject'].each do |subject|
        Severity: Minor
        Found in lib/whos_got_dirt/requests/relation/open_corporates.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