18F/cg-sandbox-bot

View on GitHub

Showing 4 of 216 total issues

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

def process_new_users

  last_user_date = nil
    users = @cf_client.get_users

Severity: Minor
Found in monitor.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 process_new_users has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def process_new_users

  last_user_date = nil
    users = @cf_client.get_users

Severity: Major
Found in monitor.rb - About 2 hrs to fix

    Method create_space has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def create_space(name, organization_guid, developer_guids, manager_guids, space_quota_guid)
    Severity: Minor
    Found in cf_client.rb - About 35 mins to fix

      Method increase_org_quota has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def increase_org_quota(org)
      
          quota = get_organization_quota(org['entity']['quota_definition_guid'])
          update_url = quota["metadata"]["url"]
          quota_total_routes = quota["entity"]["total_routes"]
      Severity: Minor
      Found in cf_client.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