saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Consider simplifying this complex logical expression.
Open

        if (update_email or update_email_port or update_email_security or
                update_email_verify_peer or update_email_verify_host or update_email_auth or
                update_script or update_script_params or update_sms or
                update_jabber or update_eztext or update_status):
            ret['result'] = True
Severity: Critical
Found in salt/states/zabbix_mediatype.py - About 2 hrs to fix

    Fileserver has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Fileserver(object):
        '''
        Create a fileserver wrapper object that wraps the fileserver functions and
        iterates over them to execute the desired function within the scope of the
        desired fileserver backend.
    Severity: Minor
    Found in salt/fileserver/__init__.py - About 2 hrs to fix

      File azurearm.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Azure (ARM) Utilities
      
      .. versionadded:: 2019.2.0
      Severity: Minor
      Found in salt/utils/azurearm.py - About 2 hrs to fix

        File napalm_probes.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        NAPALM Probes
        =============
        
        
        Severity: Minor
        Found in salt/modules/napalm_probes.py - About 2 hrs to fix

          File caller.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          The caller module is used as a front-end to manage direct calls to the salt
          minion modules.
          '''
          Severity: Minor
          Found in salt/cli/caller.py - About 2 hrs to fix

            Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
                if ( postFilter && !postFilter[ expando ] ) {
                    postFilter = setMatcher( postFilter );
                }
                if ( postFinder && !postFinder[ expando ] ) {
            Severity: Major
            Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

              File ssh_py_shim.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # pylint: disable=no-encoding-in-file,resource-leakage
              '''
              This is a shim that handles checking and updating salt thin and
              then invoking thin.
              
              
              Severity: Minor
              Found in salt/client/ssh/ssh_py_shim.py - About 2 hrs to fix

                Function _stream_read has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _stream_read(self, client):
                        unpacker = msgpack.Unpacker()
                        while not self._closing:
                            try:
                                client._read_until_future = client.stream.read_bytes(4096, partial=True)
                Severity: Minor
                Found in salt/transport/tcp.py - About 2 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 contains has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def contains(name,
                             value,
                             count_lt=None,
                             count_lte=None,
                             count_eq=None,
                Severity: Minor
                Found in salt/thorium/check.py - About 2 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 targets has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def targets(tgt, tgt_type='glob', **kwargs):  # pylint: disable=W0613
                    '''
                    Return the targets from the Salt Masters' minion cache.
                    All targets and matchers are supported.
                
                
                Severity: Minor
                Found in salt/roster/cache.py - About 2 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 _text has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def _text(username, password, **kwargs):
                    '''
                    The text file function can authenticate plaintext and digest methods
                    that are available in the :py:func:`hashutil.digest <salt.modules.hashutil.digest>`
                    function.
                Severity: Minor
                Found in salt/auth/file.py - About 2 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 targets has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def targets(tgt, tgt_type='glob', **kwargs):  # pylint: disable=W0613
                    '''
                    Return the targets from the flat yaml file, checks opts for location but
                    defaults to /etc/salt/roster
                    '''
                Severity: Minor
                Found in salt/roster/cloud.py - About 2 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 event_return has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def event_return(events):
                    '''
                    Return event to etcd server
                
                    Requires that configuration enabled via 'event_return'
                Severity: Minor
                Found in salt/returners/etcd_return.py - About 2 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 _verify_install has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def _verify_install(desired, new_pkgs, ignore_epoch=False, new_caps=None):
                    '''
                    Determine whether or not the installed packages match what was requested in
                    the SLS file.
                    '''
                Severity: Minor
                Found in salt/states/pkg.py - About 2 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 _function_permissions_present has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def _function_permissions_present(FunctionName, Permissions,
                                                  region, key, keyid, profile):
                    ret = {'result': True, 'comment': '', 'changes': {}}
                    curr_permissions = __salt__['boto_lambda.get_permissions'](
                        FunctionName, region=region,
                Severity: Minor
                Found in salt/states/boto_lambda.py - About 2 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 _compute_diff has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def _compute_diff(expected_endpoints, configured_endpoints):
                    '''
                    Compares configured endpoints with the expected configuration and returns the differences.
                    '''
                    new_endpoints = []
                Severity: Minor
                Found in salt/states/statuspage.py - About 2 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 inherit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def inherit(name, objectType, clear_existing_acl=False):
                    '''
                    Ensure an object is inheriting ACLs from its parent
                    '''
                    ret = {'name': name,
                Severity: Minor
                Found in salt/states/win_dacl.py - About 2 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 disinherit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def disinherit(name, objectType, copy_inherited_acl=True):
                    '''
                    Ensure an object is not inheriting ACLs from its parent
                    '''
                    ret = {'name': name,
                Severity: Minor
                Found in salt/states/win_dacl.py - About 2 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 tenant_present has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def tenant_present(name, description=None, enabled=True, profile=None,
                                   **connection_args):
                    '''
                    Ensures that the keystone tenant exists
                
                
                Severity: Minor
                Found in salt/states/keystone.py - About 2 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 distribution_absent has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def distribution_absent(name, region=None, key=None, keyid=None, profile=None, **kwargs):
                    '''
                    Ensure a distribution with the given Name tag does not exist.
                
                    Note that CloudFront does not allow directly deleting an enabled
                Severity: Minor
                Found in salt/states/boto_cloudfront.py - About 2 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