saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function wrap_tmpl_func has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

def wrap_tmpl_func(render_str):

    def render_tmpl(tmplsrc,
                    from_str=False,
                    to_str=False,
Severity: Minor
Found in salt/utils/templates.py - About 1 day 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 pg_create has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

def pg_create(name, hostgroup=None, host=None, volume=None, enabled=True):
    '''

    Create a protection group on a Pure Storage FlashArray.

Severity: Minor
Found in salt/modules/purefa.py - About 1 day 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 info has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

def info(name, path=None):
    '''
    Returns information about a container

    path
Severity: Minor
Found in salt/modules/lxc.py - About 1 day 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 run_chunked has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    def run_chunked(self):
        '''
        Make the salt client call in the new fasion chunked multi-call way
        '''
        files, empty_dirs = self._list_files()
Severity: Minor
Found in salt/cli/cp.py - About 1 day 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 glassfish.py has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Module for working with the Glassfish/Payara 4.x management API
.. versionadded:: Carbon
:depends: requests
Severity: Major
Found in salt/modules/glassfish.py - About 1 day to fix

    Function _check_all_deps has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

        def _check_all_deps(self, pkg_name=None, pkg_file=None, formula_def=None):
            '''
            Starting with one package, check all packages for dependencies
            '''
            if pkg_file and not os.path.exists(pkg_file):
    Severity: Minor
    Found in salt/spm/__init__.py - About 1 day 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 copy_ has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def copy_(name,
              source,
              force=False,
              makedirs=False,
              preserve=False,
    Severity: Minor
    Found in salt/states/file.py - About 1 day 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 present has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def present(name, acl_type, acl_name='', perms='', recurse=False, force=False):
        '''
        Ensure a Linux ACL is present
    
        name
    Severity: Minor
    Found in salt/states/linux_acl.py - About 1 day 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 row_present has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def row_present(name,
                    db,
                    table,
                    data,
                    where_sql,
    Severity: Minor
    Found in salt/states/sqlite3.py - About 1 day 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 present has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def present(name,
                level,
                devices,
                **kwargs):
        '''
    Severity: Minor
    Found in salt/states/mdadm_raid.py - About 1 day 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_repo has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_repo(repo, **kwargs):
        '''
        Display a repo from the sources.list / sources.list.d
    
        The repo passed in needs to be a complete repo entry.
    Severity: Minor
    Found in salt/modules/aptpkg.py - About 1 day 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 catalog_register has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def catalog_register(consul_url=None, token=None, **kwargs):
        '''
        Registers a new node, service, or check
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - About 1 day 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 csf.py has 523 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Support for Config Server Firewall (CSF)
    ========================================
    :maintainer: Mostafa Hussein <mostafa.hussein91@gmail.com>
    Severity: Major
    Found in salt/modules/csf.py - About 1 day to fix

      File zfs.py has 522 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Utility functions for zfs
      
      These functions are for dealing with type conversion and basic execution
      Severity: Major
      Found in salt/utils/zfs.py - About 1 day to fix

        File napalm_yang_mod.py has 521 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        NAPALM YANG
        ===========
        
        
        Severity: Major
        Found in salt/modules/napalm_yang_mod.py - About 1 day to fix

          File softlayer_hw.py has 521 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          SoftLayer HW Cloud Module
          =========================
          
          
          Severity: Major
          Found in salt/cloud/clouds/softlayer_hw.py - About 1 day to fix

            Function _create_repo has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

                def _create_repo(self, args):
                    '''
                    Scan a directory and create an SPM-METADATA file which describes
                    all of the SPM files in that directory.
                    '''
            Severity: Minor
            Found in salt/spm/__init__.py - About 1 day 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 certificate_managed has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            def certificate_managed(name,
                                    days_remaining=90,
                                    managed_private_key=None,
                                    append_certs=None,
                                    **kwargs):
            Severity: Minor
            Found in salt/states/x509.py - About 1 day 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_if_installed has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            def _check_if_installed(prefix,
                                    state_pkg_name,
                                    version_spec,
                                    ignore_installed,
                                    force_reinstall,
            Severity: Minor
            Found in salt/states/pip_state.py - About 1 day 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 _copy_lx_vars has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            def _copy_lx_vars(vmconfig):
                # NOTE: documentation on dockerinit: https://github.com/joyent/smartos-live/blob/master/src/dockerinit/README.md
                if 'image_uuid' in vmconfig:
                    # NOTE: retrieve tags and type from image
                    imgconfig = __salt__['imgadm.get'](vmconfig['image_uuid']).get('manifest', {})
            Severity: Minor
            Found in salt/states/smartos.py - About 1 day 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