saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Avoid deeply nested control flow statements.
Open

                    for pkg_ver in pkg_info.keys():
                        if pkg_info[pkg_ver]['full_name'] == pkg_name:
                            val = pkg_ver
                __salt__['pkg_resource.add_pkg'](ret, key, val)
Severity: Major
Found in salt/modules/win_pkg.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

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

      Avoid deeply nested control flow statements.
      Open

                          if not cached_pkg:
                              log.error('Unable to cache %s', uninstaller)
                              ret[pkgname] = {'unable to cache': uninstaller}
                              continue
      
      
      Severity: Major
      Found in salt/modules/win_pkg.py - About 45 mins to fix

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

        def get_attributes(path):
            '''
            Return a dictionary object with the Windows
            file attributes for a file.
        
        
        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

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

        def status(name, sig=None):
            '''
            Return the status for a service.
            If the name contains globbing, a dict mapping service name to True/False
            values is returned.
        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

                            for skey in subkeys:
                                if skey not in subresult:
                                    subresult[skey] = {}
                                subresult = subresult[skey]
                        subresult[subkey] = subval
        Severity: Major
        Found in salt/modules/sysfs.py - About 45 mins to fix

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

          def clone(cwd,
                    url=None,  # Remove default value once 'repository' arg is removed
                    name=None,
                    opts='',
                    git_opts='',
          Severity: Minor
          Found in salt/modules/git.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_all_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_all_groups(region=None, key=None, keyid=None, profile=None):
              '''
              Return all AutoScale Groups visible in the account
              (as a list of boto.ec2.autoscale.group.AutoScalingGroup).
          
          
          Severity: Minor
          Found in salt/modules/boto_asg.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 remote_refs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def remote_refs(url,
                          heads=False,
                          tags=False,
                          user=None,
                          password=None,
          Severity: Minor
          Found in salt/modules/git.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 signal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def signal(signal=None):
              '''
              Signals nginx to start, reload, reopen or stop.
          
              CLI Example:
          Severity: Minor
          Found in salt/modules/nginx.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 user:
                                  os.chown(id_file,
                                           __salt__['file.user_to_uid'](user),
                                           -1)
                      else:
          Severity: Major
          Found in salt/modules/git.py - About 45 mins to fix

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

            def get_cloud_init_mime(cloud_init):
                '''
                Get a mime multipart encoded string from a cloud-init dict. Currently
                supports boothooks, scripts and cloud-config.
            
            
            Severity: Minor
            Found in salt/modules/boto_asg.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_parameter_group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def describe_parameter_group(name, Filters=None, MaxRecords=None, Marker=None,
                                         region=None, key=None, keyid=None, profile=None):
                '''
                Returns a list of `DBParameterGroup` descriptions.
                CLI example to description of parameter group::
            Severity: Minor
            Found in salt/modules/boto_rds.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 enabled has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def enabled(name, **kwargs):
                '''
                Return True if the named service is enabled at boot and the provided
                flags match the configured ones (if any). Return False otherwise.
            
            
            Severity: Minor
            Found in salt/modules/openbsdrcctl_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

                                for current_disk in disks_to_update:
                                    disk_spec = vim.vm.device.VirtualDeviceSpec()
                                    disk_spec.device = current_disk
                                    disk_spec.operation = 'edit'
                                    device_config_specs.append(disk_spec)
            Severity: Major
            Found in salt/modules/vsphere.py - About 45 mins to fix

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

                  def __getattr__(self, item):
                      '''
                      Call configurator.
              
                      :param item:
              Severity: Minor
              Found in salt/modules/zypperpkg.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 add_capacity_to_diskgroup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def add_capacity_to_diskgroup(cache_disk_id, capacity_disk_ids,
                                            safety_checks=True, service_instance=None):
                  '''
                  Adds capacity disks to the disk group with the specified cache disk.
              
              
              Severity: Minor
              Found in salt/modules/vsphere.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_object_body has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def __create_object_body(kind,
                                       obj_class,
                                       spec_creator,
                                       name,
                                       namespace,
              Severity: Minor
              Found in salt/modules/kubernetesmod.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 latest_version has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def latest_version(*names, **kwargs):
                  '''
                  Return the latest version of the named package available for upgrade or
                  installation. If more than one package name is specified, a dict of
                  name/version pairs is returned.
              Severity: Minor
              Found in salt/modules/zypperpkg.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 disk_key in current_scsi['device']:
                                      disk_objects = \
                                          [disk['object'] for disk in current_disks]
                                      disks_to_update.append(
                                          _get_device_by_key(disk_objects, disk_key))
              Severity: Major
              Found in salt/modules/vsphere.py - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language