saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function tenant_delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def tenant_delete(tenant_id=None, name=None, profile=None, **connection_args):
    '''
    Delete a tenant (keystone tenant-delete)

    CLI Examples:
Severity: Minor
Found in salt/modules/keystone.py - 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

Function _parse_settings_bond has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_settings_bond(opts, iface):
    '''
    Filters given options and outputs valid settings for requested
    operation. If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
Severity: Minor
Found in salt/modules/rh_ip.py - 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

Function build_routes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def build_routes(iface, **settings):
    '''
    Build a route script for a network interface.

    CLI Example:
Severity: Minor
Found in salt/modules/rh_ip.py - 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

Avoid deeply nested control flow statements.
Open

                    if key not in ret:
                        ret[key] = []
                else:
Severity: Major
Found in salt/modules/zonecfg.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if 'property' not in resdata:
                            resdata[key] = {}
                        kv = _parse_value(line.strip()[line.strip().index(':')+1:])
    Severity: Major
    Found in salt/modules/zonecfg.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if ipconfig.get('public_ip_address'):
                              pub_ip = public_ip_address_get(
                                  name=ipconfig['public_ip_address'],
                                  resource_group=resource_group,
                                  **kwargs
      Severity: Major
      Found in salt/modules/azurearm_network.py - About 45 mins to fix

        Function check_inheritance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def check_inheritance(path, objectType, user=None):
            '''
            Check a specified path to verify if inheritance is enabled
        
            Args:
        Severity: Minor
        Found in salt/modules/win_dacl.py - 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

        Avoid deeply nested control flow statements.
        Open

                            if 'name' in kv and 'value' in kv:
                                res[key][kv['name']] = kv['value']
                            else:
                                log.warning('zonecfg.info - not sure how to deal with: %s', kv)
                        else:
        Severity: Major
        Found in salt/modules/zonecfg.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if not propagationbit or (ace[0][1] & propagationbit) == propagationbit:
                                  if not permissionbit:
                                      ret['Exists'] = True
                                      return ret
                                  if exactPermissionMatch:
          Severity: Major
          Found in salt/modules/win_dacl.py - About 45 mins to fix

            Function role_delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def role_delete(role_id=None, name=None, profile=None,
                            **connection_args):
                '''
                Delete a role (keystone role-delete)
            
            
            Severity: Minor
            Found in salt/modules/keystone.py - 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

            Function apply_network_settings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def apply_network_settings(**settings):
                '''
                Apply global network configuration.
            
                CLI Example:
            Severity: Minor
            Found in salt/modules/rh_ip.py - 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

            Function get_unassociated_eip_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_unassociated_eip_address(domain='standard', region=None, key=None,
                                             keyid=None, profile=None):
                '''
                Return the first unassociated EIP
            
            
            Severity: Minor
            Found in salt/modules/boto_ec2.py - 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

            Avoid deeply nested control flow statements.
            Open

                                if bond['arp_ip_target']:
                                    bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
                                else:
                                    bond['arp_ip_target'] = ip
                        else:
            Severity: Major
            Found in salt/modules/rh_ip.py - About 45 mins to fix

              Function security_rule_create_or_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def security_rule_create_or_update(name, access, direction, priority, protocol, security_group, resource_group,
                                                 source_address_prefix=None, destination_address_prefix=None, source_port_range=None,
                                                 destination_port_range=None, source_address_prefixes=None,
                                                 destination_address_prefixes=None, source_port_ranges=None,
                                                 destination_port_ranges=None, **kwargs):
              Severity: Minor
              Found in salt/modules/azurearm_network.py - 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

              Function create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def create(zone, brand, zonepath, force=False):
                  '''
                  Create an in-memory configuration for the specified zone.
              
                  zone : string
              Severity: Minor
              Found in salt/modules/zonecfg.py - 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

              Avoid deeply nested control flow statements.
              Open

                                  for vnet in vnets:
                                      subnets = subnets_list(
                                          virtual_network=vnet,
                                          resource_group=resource_group,
                                          **kwargs
              Severity: Major
              Found in salt/modules/azurearm_network.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if isinstance(ipconfig.get('application_gateway_backend_address_pools'), list):
                                        # TODO: Add ID lookup for referenced object names
                                        pass
                                    if isinstance(ipconfig.get('load_balancer_backend_address_pools'), list):
                Severity: Major
                Found in salt/modules/azurearm_network.py - About 45 mins to fix

                  Function _blkid_output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _blkid_output(out):
                      '''
                      Parse blkid output.
                      '''
                      flt = lambda data: [el for el in data if el.strip()]
                  Severity: Minor
                  Found in salt/modules/xfs.py - 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

                  Avoid deeply nested control flow statements.
                  Open

                                      if tAce[2] == sidRet['sid']:
                                          if not acetypebit or tAce[0][0] == acetypebit:
                                              if not propagationbit or ((tAce[0][1] & propagationbit) == propagationbit):
                                                  if not permissionbit or tAce[1] == permissionbit:
                                                      dacl.DeleteAce(counter)
                  Severity: Major
                  Found in salt/modules/win_dacl.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (tAce[0][1] & win32security.INHERITED_ACE) != win32security.INHERITED_ACE:
                                                tdacl.DeleteAce(counter)
                                                removedAces.append(_ace_to_text(tAce, objectType))
                                            else:
                                                counter = counter + 1
                    Severity: Major
                    Found in salt/modules/win_dacl.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language