saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function create has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

def create(path,
           venv_bin=None,
           system_site_packages=False,
           distribute=False,
           clear=False,
Severity: Minor
Found in salt/modules/virtualenv_mod.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 genesis.py has 592 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Module for managing container and VM images

.. versionadded:: 2014.7.0
Severity: Major
Found in salt/modules/genesis.py - About 1 day to fix

    Function export has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    def export(name, path, replace=False):
        '''
        Export a zones configuration
    
        name : string
    Severity: Minor
    Found in salt/states/zone.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 insert has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    def insert(name, table='filter', family='ipv4', **kwargs):
        '''
        .. versionadded:: 2014.1.0
    
        Insert a rule into a chain
    Severity: Minor
    Found in salt/states/iptables.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 __init__ has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, opts, remote, per_remote_defaults, per_remote_only,
                     override_params, cache_root, role='gitfs'):
            self.opts = opts
            self.role = role
            self.global_saltenv = salt.utils.data.repack_dictlist(
    Severity: Minor
    Found in salt/utils/gitfs.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 _sysfs_parse has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    def _sysfs_parse(path, base_attr=None, stats=False, config=False, internals=False, options=False):
        '''
        Helper function for parsing BCache's SysFS interface
        '''
        result = {}
    Severity: Minor
    Found in salt/modules/bcache.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 create has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    def create(vm_):
        '''
        Create a single VM from a data dict
        '''
        try:
    Severity: Minor
    Found in salt/cloud/clouds/digitalocean.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 format_slots has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def format_slots(self, cdata):
            '''
            Read in the arguments from the low level slot syntax to make a last
            minute runtime call to gather relevant data for the specific routine
    
    
    Severity: Minor
    Found in salt/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 top_matches has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def top_matches(self, top):
            '''
            Search through the top high data for matches and return the states
            that this minion needs to execute.
    
    
    Severity: Minor
    Found in salt/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

    File win_dsc.py has 585 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Module for working with Windows PowerShell DSC (Desired State Configuration)
    
    This module is Alpha
    Severity: Major
    Found in salt/modules/win_dsc.py - About 1 day to fix

      File digicertapi.py has 585 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Support for Digicert.  Heavily based on the Venafi runner by Joseph Hall (jphall@saltstack.com).
      
      Before using this module you need to register an account with Digicert's CertCentral.
      Severity: Major
      Found in salt/runners/digicertapi.py - About 1 day to fix

        File nova.py has 582 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Module for handling OpenStack Nova calls
        
        :depends:   - novaclient Python module
        Severity: Major
        Found in salt/modules/nova.py - About 1 day to fix

          File aptly.py has 580 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Aptly Debian repository manager.
          
          .. versionadded:: 2018.3.0
          Severity: Major
          Found in salt/modules/aptly.py - About 1 day to fix

            Function present has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
            Open

            def present(name, properties=None, filesystem_properties=None, layout=None, config=None):
                '''
                ensure storage pool is present on the system
            
                name : string
            Severity: Minor
            Found in salt/states/zpool.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 managed has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
            Open

            def managed(name,
                        venv_bin=None,
                        requirements=None,
                        system_site_packages=False,
                        distribute=False,
            Severity: Minor
            Found in salt/states/virtualenv_mod.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_client_args has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_client_args(limit=None):
                if not HAS_DOCKER_PY:
                    raise CommandExecutionError('docker Python module not imported')
            
                limit = salt.utils.args.split_input(limit or [])
            Severity: Minor
            Found in salt/utils/docker/__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 cpuinfo has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
            Open

            def cpuinfo():
                '''
                .. versionchanged:: 2016.3.2
                    Return the CPU info for this minion
            
            
            Severity: Minor
            Found in salt/modules/status.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 _getDataFromRegPolData has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
            Open

            def _getDataFromRegPolData(search_string, policy_data, return_value_name=False):
                '''
                helper function to do a search of Policy data from a registry.pol file
                returns the "data" field
                https://msdn.microsoft.com/en-us/library/aa374407(VS.85).aspx
            Severity: Minor
            Found in salt/modules/win_lgpo.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 _getAdmlPresentationRefId has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
            Open

            def _getAdmlPresentationRefId(adml_data, ref_id):
                '''
                helper function to check for a presentation label for a policy element
                '''
                search_results = adml_data.xpath('//*[@*[local-name() = "refId"] = "{0}"]'.format(ref_id))
            Severity: Minor
            Found in salt/modules/win_lgpo.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 lxc.py has 578 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Manage Linux Containers
            =======================
            '''
            Severity: Major
            Found in salt/states/lxc.py - About 1 day to fix
              Severity
              Category
              Status
              Source
              Language