saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function get_community_names has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def get_community_names():
    '''
    Get the current accepted SNMP community names and their permissions.

    If community names are being managed by Group Policy, those values will be
Severity: Minor
Found in salt/modules/win_snmp.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_caps_cpu has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_caps_cpu(node):
    '''
    Parse the <cpu> element of the domain capabilities
    '''
    result = {}
Severity: Minor
Found in salt/modules/virt.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 swaps has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def swaps():
    '''
    Return a dict containing information on active swap

    .. versionchanged:: 2016.3.2
Severity: Minor
Found in salt/modules/mount.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 set_syslog_config has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def set_syslog_config(host,
                      username,
                      password,
                      syslog_config,
                      config_value,
Severity: Minor
Found in salt/modules/vsphere.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 create_or_update_resource has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def create_or_update_resource(resource_name, identifier_fields, data, diff=None, profile='pagerduty', subdomain=None, api_key=None):
    '''
    create or update any pagerduty resource
    Helper method for present().

Severity: Minor
Found in salt/modules/pagerduty_util.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 _get_options has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def _get_options(**kwargs):
    '''
    Returns a list of options to be used in the yum/dnf command, based on the
    kwargs passed.
    '''
Severity: Minor
Found in salt/modules/yumpkg.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 _create_eni_if_necessary has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def _create_eni_if_necessary(interface, vm_):
    '''
    Create an Elastic Interface if necessary and return a Network Interface Specification
    '''
    if 'NetworkInterfaceId' in interface and interface['NetworkInterfaceId'] is not None:
Severity: Minor
Found in salt/cloud/clouds/ec2.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 create has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def create(vm_):
    '''
    if configuration parameter ``deploy`` is ``True``,

        Provision a single machine, adding its keys to the salt master
Severity: Minor
Found in salt/cloud/clouds/saltify.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 create has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def create(vm_):
    '''
    Create a single Linode VM.
    '''
    name = vm_['name']
Severity: Minor
Found in salt/cloud/clouds/linode.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 _ext_pillar has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def _ext_pillar(minion_id,
                root_dir,
                follow_dir_links,
                debug,
                keep_newline,
Severity: Minor
Found in salt/pillar/file_tree.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 decrypt_pillar has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def decrypt_pillar(self, pillar):
        '''
        Decrypt the specified pillar dictionary items, if configured to do so
        '''
        errors = []
Severity: Minor
Found in salt/pillar/__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 beacon has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Return status for requested information
    '''
    log.debug(config)
Severity: Minor
Found in salt/beacons/status.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 clear_lock has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def clear_lock(remote=None):
    '''
    Clear update.lk

    ``remote`` can either be a dictionary containing repo configuration
Severity: Minor
Found in salt/fileserver/svnfs.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 clear_lock has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def clear_lock(remote=None):
    '''
    Clear update.lk

    ``remote`` can either be a dictionary containing repo configuration
Severity: Minor
Found in salt/fileserver/hgfs.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

SPMClient has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class SPMClient(object):
    '''
    Provide an SPM Client
    '''
    def __init__(self, ui, opts=None):  # pylint: disable=W0231
Severity: Minor
Found in salt/spm/__init__.py - About 4 hrs to fix

    File postgres_local_cache.py has 346 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Use a postgresql server for the master job cache. This helps the job cache to
    cope with scale.
    
    
    Severity: Minor
    Found in salt/returners/postgres_local_cache.py - About 4 hrs to fix

      File payload.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Many aspects of the salt payload need to be managed, from the return of
      encrypted keys to general payload dynamics and packaging, these happen
      in here
      Severity: Minor
      Found in salt/payload.py - About 4 hrs to fix

        File win_wua.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Installation of Windows Updates using the Windows Update Agent
        
        .. versionadded:: 2017.7.0
        Severity: Minor
        Found in salt/states/win_wua.py - About 4 hrs to fix

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

          def timeout(name, delete=0, reject=0):
              '''
              If any minion's status is older than the timeout value then apply the
              given action to the timed out key. This example will remove keys to
              minions that have not checked in for 300 seconds (5 minutes)
          Severity: Minor
          Found in salt/thorium/key.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 minion_publish has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              def minion_publish(self, load):
                  '''
                  Publish a command initiated from a minion, this method executes minion
                  restrictions so that the minion publication will only work if it is
                  enabled in the config.
          Severity: Minor
          Found in salt/daemons/masterapi.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