saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function include_config has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def include_config(include, orig_path, verbose, exit_on_config_errors=False):
    '''
    Parses extra configuration file(s) specified in an include list in the
    main config file.
    '''
Severity: Minor
Found in salt/config/__init__.py - About 4 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

Function apply_minion_config has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def apply_minion_config(overrides=None,
                        defaults=None,
                        cache_minion_id=False,
                        minion_id=None):
    '''
Severity: Minor
Found in salt/config/__init__.py - About 4 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

Function check_file_list_cache has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def check_file_list_cache(opts, form, list_cache, w_lock):
    '''
    Checks the cache file to see if there is a new enough file list cache, and
    returns the match (if found, along with booleans used by the fileserver
    backend to determine if the cache needs to be refreshed/written).
Severity: Minor
Found in salt/fileserver/__init__.py - About 4 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

Function file_hash has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def file_hash(load, fnd):
    '''
    Return a file hash, the hash type is set in the master config file
    '''
    if 'env' in load:
Severity: Minor
Found in salt/fileserver/roots.py - About 4 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

File boto_elasticsearch_domain.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Connection module for Amazon Elasticsearch Service

.. versionadded:: 2016.11.0
Severity: Minor
Found in salt/modules/boto_elasticsearch_domain.py - About 4 hrs to fix

    File win_task.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383608(v=vs.85).aspx
    from __future__ import absolute_import, print_function, unicode_literals
    
    
    
    Severity: Minor
    Found in salt/states/win_task.py - About 4 hrs to fix

      File svn.py has 340 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Subversion SCM
      '''
      from __future__ import absolute_import, unicode_literals, print_function
      Severity: Minor
      Found in salt/modules/svn.py - About 4 hrs to fix

        File glusterfs.py has 339 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Manage GlusterFS pool.
        '''
        
        
        Severity: Minor
        Found in salt/states/glusterfs.py - About 4 hrs to fix

          File swarm.py has 339 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Docker Swarm Module using Docker's Python SDK
          =============================================
          
          
          Severity: Minor
          Found in salt/modules/swarm.py - About 4 hrs to fix

            File boto3_sns.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Manage SNS Topics
            =================
            
            
            Severity: Minor
            Found in salt/states/boto3_sns.py - About 4 hrs to fix

              File container_resource.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Common resources for LXC and systemd-nspawn containers
              
              .. versionadded:: 2015.8.0
              Severity: Minor
              Found in salt/modules/container_resource.py - About 4 hrs to fix

                File esxvm.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                    :codeauthor: :email:`Agnes Tevesz (agnes.tevesz@morganstanley.com)`
                
                    salt.config.schemas.esxvm
                Severity: Minor
                Found in salt/config/schemas/esxvm.py - About 4 hrs to fix

                  Function check_authentication has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_authentication(self, load, auth_type, key=None, show_username=False):
                          '''
                          .. versionadded:: 2018.3.0
                  
                          Go through various checks to see if the token/eauth/user can be authenticated.
                  Severity: Minor
                  Found in salt/auth/__init__.py - About 4 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

                  Function parse_ssh_config has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def parse_ssh_config(lines):
                      '''
                      Parses lines from the SSH config to create roster targets.
                  
                      :param lines: Individual lines from the ssh config file
                  Severity: Minor
                  Found in salt/roster/sshconfig.py - About 4 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

                  Function authenticate_key has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def authenticate_key(self, load, key):
                          '''
                          Authenticate a user by the key passed in load.
                          Return the effective user id (name) if it's different from the specified one (for sudo).
                          If the effective user id is the same as the passed one, return True on success or False on
                  Severity: Minor
                  Found in salt/auth/__init__.py - About 4 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

                  Function _syndic_return has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _syndic_return(self, load):
                          '''
                          Receive a syndic minion return and format it to look like returns from
                          individual minions.
                  
                  
                  Severity: Minor
                  Found in salt/master.py - About 4 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

                  Function installed has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def installed(name,
                                pkgs=None,
                                user=None,
                                install_global=False,
                                env=None):
                  Severity: Minor
                  Found in salt/states/cabal.py - About 4 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

                  Function topic_absent has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def topic_absent(name, unsubscribe=False, region=None, key=None, keyid=None, profile=None):
                      '''
                      Ensure the named sns topic is deleted.
                  
                      name
                  Severity: Minor
                  Found in salt/states/boto3_sns.py - About 4 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

                  Function auth has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def auth(name, nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None):
                      '''
                      Ensure all nodes are authorized to the cluster
                  
                      name
                  Severity: Minor
                  Found in salt/states/pcs.py - About 4 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

                  Function absent has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def absent(name, acl_type, acl_name='', perms='', recurse=False):
                      '''
                      Ensure a Linux ACL does not exist
                  
                      name
                  Severity: Minor
                  Found in salt/states/linux_acl.py - About 4 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

                  Severity
                  Category
                  Status
                  Source
                  Language