saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Avoid deeply nested control flow statements.
Open

                    if result['stderr']:
                        error += ': {0}'.format(result['stderr'])
                    raise CommandExecutionError(error)
Severity: Major
Found in salt/modules/container_resource.py - About 45 mins to fix

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

    def disassociate_network_acl(subnet_id=None, vpc_id=None, subnet_name=None, vpc_name=None,
                                 region=None, key=None, keyid=None, profile=None):
        '''
        Given a subnet ID, disassociates a network acl.
    
    
    Severity: Minor
    Found in salt/modules/boto_vpc.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 delete_internet_gateway has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete_internet_gateway(internet_gateway_id=None,
                                internet_gateway_name=None,
                                detach=False, region=None,
                                key=None, keyid=None, profile=None):
        '''
    Severity: Minor
    Found in salt/modules/boto_vpc.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 replace_route has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def replace_route(route_table_id=None, destination_cidr_block=None,
                      route_table_name=None, gateway_id=None,
                      instance_id=None, interface_id=None,
                      region=None, key=None, keyid=None, profile=None,
                      vpc_peering_connection_id=None):
    Severity: Minor
    Found in salt/modules/boto_vpc.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 volume_infos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def volume_infos(pool=None, volume=None, **kwargs):
        '''
        Provide details on a storage volume. If no volume name is provided, the infos
        all the volumes contained in the pool are provided. If no pool is provided,
        the infos of the volumes of all pools are output.
    Severity: Minor
    Found in salt/modules/virt.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 __execute_cmd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def __execute_cmd(command, host=None,
                      admin_username=None, admin_password=None,
                      module=None):
        '''
        Execute rac commands
    Severity: Minor
    Found in salt/modules/dracr.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 _maybe_name_route_table has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _maybe_name_route_table(conn, vpcid, vpc_name):
        route_tables = conn.get_all_route_tables(filters={'vpc_id': vpcid})
        if not route_tables:
            log.warning('no default route table found')
            return
    Severity: Minor
    Found in salt/modules/boto_vpc.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 tagitem in item.get(inkey, []):
                                route_table[outkey][tagitem.get('Key')] = tagitem.get('Value')
                        else:
    Severity: Major
    Found in salt/modules/boto_vpc.py - About 45 mins to fix

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

      def create_dhcp_options(domain_name=None, domain_name_servers=None, ntp_servers=None,
                              netbios_name_servers=None, netbios_node_type=None,
                              dhcp_options_name=None, tags=None, vpc_id=None, vpc_name=None,
                              region=None, key=None, keyid=None, profile=None):
          '''
      Severity: Minor
      Found in salt/modules/boto_vpc.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 describe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def describe(vpc_id=None, vpc_name=None, region=None, key=None,
                   keyid=None, profile=None):
          '''
          Given a VPC ID describe its properties.
      
      
      Severity: Minor
      Found in salt/modules/boto_vpc.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 automaster has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def automaster(config='/etc/auto_salt'):
          '''
          List the contents of the auto master
      
          CLI Example:
      Severity: Minor
      Found in salt/modules/mount.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_source_sum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_source_sum(source_hash, file_path, saltenv):
          '''
          Extract the hash sum, whether it is in a remote hash file, or just a string.
          '''
          ret = dict()
      Severity: Minor
      Found in salt/modules/win_pkg.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

                          while time.time() < t_end:
                              time.sleep(0.25)
                              task_running = __salt__['task.status'](
                                      'update-salt-software') == 'Running'
                              if task_running:
      Severity: Major
      Found in salt/modules/win_pkg.py - About 45 mins to fix

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

        def __virtual__():
            '''
            Only work on Ubuntu
            '''
            # Disable on these platforms, specific service modules exist:
        Severity: Minor
        Found in salt/modules/upstart_service.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 __salt__['cp.hash_file'](uninstaller, saltenv) != \
                                    __salt__['cp.hash_file'](cached_pkg):
                                try:
                                    cached_pkg = __salt__['cp.cache_file'](
                                        uninstaller, saltenv)
        Severity: Major
        Found in salt/modules/win_pkg.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if report_reboot_exit_codes:
                                  __salt__['system.set_reboot_required_witnessed']()
                              ret[pkgname] = {'uninstall status': 'success, reboot required'}
          Severity: Major
          Found in salt/modules/win_pkg.py - About 45 mins to fix

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

            def makedirs_(path,
                          owner=None,
                          grant_perms=None,
                          deny_perms=None,
                          inheritance=True,
            Severity: Minor
            Found in salt/modules/win_file.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 not task_running:
                                    log.error('Failed to install %s', pkg_name)
                                    log.error('Scheduled Task failed to run')
                                    ret[pkg_name] = {'install status': 'failed'}
            
            
            Severity: Major
            Found in salt/modules/win_pkg.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if not cached_file:
                                      log.error('Unable to cache %s', cache_file)
                                      ret[pkg_name] = {
                                          'failed to cache cache_file': cache_file
                                      }
              Severity: Major
              Found in salt/modules/win_pkg.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if not pkg_info:
                                        continue
                                    for pkg_ver in pkg_info.keys():
                Severity: Major
                Found in salt/modules/win_pkg.py - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language