saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

    def location_list(self, lookup='all'):
        '''
        Return a mapping of all location data for available providers
        '''
        data = {}
Severity: Minor
Found in salt/cloud/__init__.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 _dnsname_match(value, hostname):
                        return
                    dnsnames.append(value)
Severity: Major
Found in salt/ext/ssl_match_hostname.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if match is not None:
                            version_num = match
                        else:
                            errors.append(
                                'No version matching \'{0}\' found for package '
    Severity: Major
    Found in salt/modules/yumpkg.py - About 45 mins to fix

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

          def size_list(self, lookup='all'):
              '''
              Return a mapping of all image data for available providers
              '''
              data = {}
      Severity: Minor
      Found in salt/cloud/__init__.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 match.group(1) == pkgtype:
                              # We've reached the targeted section
                              target_found = True
                          continue
      Severity: Major
      Found in salt/modules/yumpkg.py - About 45 mins to fix

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

        def add_metaclass(metaclass):
            """Class decorator for creating a class with a metaclass."""
            def wrapper(cls):
                orig_vars = cls.__dict__.copy()
                slots = orig_vars.get('__slots__')
        Severity: Minor
        Found in salt/ext/six.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 str(task) in taskList:
                             continue
        
        
        Severity: Major
        Found in salt/ext/vsan/vsanapiutils.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if salt.utils.versions.compare(ver1=version_num,
                                                             oper='==',
                                                             ver2=ver,
                                                             cmp_func=version_cmp,
                                                             ignore_epoch=ignore_epoch):
          Severity: Major
          Found in salt/modules/yumpkg.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for ver in cver:
                                    if salt.utils.versions.compare(ver1=version_num,
                                                                   oper='>=',
                                                                   ver2=ver,
                                                               cmp_func=version_cmp,
            Severity: Major
            Found in salt/modules/yumpkg.py - About 45 mins to fix

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

                  def image_list(self, lookup='all'):
                      '''
                      Return a mapping of all image data for available providers
                      '''
                      data = {}
              Severity: Minor
              Found in salt/cloud/__init__.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 alias not in interpolated_map:
                                          interpolated_map[alias] = {}
                                      if driver not in interpolated_map[alias]:
              Severity: Major
              Found in salt/cloud/__init__.py - About 45 mins to fix

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

                def _get_node(name=None, instance_id=None, location=None):
                    if location is None:
                        location = get_location()
                
                    params = {'Action': 'DescribeInstances'}
                Severity: Minor
                Found in salt/cloud/clouds/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 driver not in interpolated_map[alias]:
                                            interpolated_map[alias][driver] = {}
                                        interpolated_map[alias][driver][vm_name] = vm_details
                Severity: Major
                Found in salt/cloud/__init__.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if self.opts['parallel']:
                                              parallel_data.append({
                                                  'opts': self.opts,
                                                  'name': name,
                                                  'alias': alias,
                  Severity: Major
                  Found in salt/cloud/__init__.py - About 45 mins to fix

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

                    def image_clone(call=None, kwargs=None):
                        '''
                        Clones an existing image.
                    
                        .. versionadded:: 2016.3.0
                    Severity: Minor
                    Found in salt/cloud/clouds/opennebula.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 list_nodes_min has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def list_nodes_min(location=None, call=None):
                        '''
                        Return a list of the VMs that are on the provider. Only a list of VM names,
                        and their state, is returned. This is the minimum amount of information
                        needed to check for existing VMs.
                    Severity: Minor
                    Found in salt/cloud/clouds/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

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

                    def __virtual__():
                        '''
                        Set up the libcloud functions and check for GCE configurations.
                        '''
                        if get_configured_provider() is False:
                    Severity: Minor
                    Found in salt/cloud/clouds/gce.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 'existing' not in ret:
                                                ret['existing'] = {}
                                            ret['existing'][name] = ret['create'].pop(name)
                    Severity: Major
                    Found in salt/cloud/__init__.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if master_finger is not None:
                                                  master_profile['master_finger'] = master_finger
                      
                                      # Generate the minion keys to pre-seed the master:
                                      for name, profile in create_list:
                      Severity: Major
                      Found in salt/cloud/__init__.py - About 45 mins to fix

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

                        def show_term_protect(name=None, instance_id=None, call=None, quiet=False):
                            '''
                            Show the details from EC2 concerning an instance's termination protection state
                        
                            '''
                        Severity: Minor
                        Found in salt/cloud/clouds/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

                        Severity
                        Category
                        Status
                        Source
                        Language