saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function vm_allocate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def vm_allocate(call=None, kwargs=None):
    '''
    Allocates a new virtual machine in OpenNebula.

    .. versionadded:: 2016.3.0
Severity: Minor
Found in salt/cloud/clouds/opennebula.py - About 35 mins 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 delete_service_certificate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def delete_service_certificate(kwargs=None, conn=None, call=None):
    '''
    .. versionadded:: 2015.8.0

    Delete a specific certificate associated with the service
Severity: Minor
Found in salt/cloud/clouds/msazure.py - About 35 mins 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_affinity_group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_affinity_group(kwargs=None, conn=None, call=None):
    '''
    .. versionadded:: 2015.8.0

    Create a new affinity group
Severity: Minor
Found in salt/cloud/clouds/msazure.py - About 35 mins 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 list_virtual_networks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_virtual_networks(call=None, kwargs=None):
    '''
    List virtual networks.
    '''
    if kwargs is None:
Severity: Minor
Found in salt/cloud/clouds/azurearm.py - About 35 mins 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 destroy_dns_records has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def destroy_dns_records(fqdn):
    '''
    Deletes DNS records for the given hostname if the domain is managed with DO.
    '''
    domain = '.'.join(fqdn.split('.')[-2:])
Severity: Minor
Found in salt/cloud/clouds/digitalocean.py - About 35 mins 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 show_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def show_image(kwargs, call=None):
    '''
    Show the details from aliyun image
    '''
    if call != 'function':
Severity: Minor
Found in salt/cloud/clouds/aliyun.py - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

def create(vm_):
    '''
    Create a VM in Xen

    The configuration for this function is read from the profile settings.
Severity: Minor
Found in salt/cloud/clouds/xen.py - About 35 mins 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_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_image(vm_):
    '''
    Return the image object to use
    '''
    images = avail_images()
Severity: Minor
Found in salt/cloud/clouds/digitalocean.py - About 35 mins 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_api_versions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_api_versions(call=None, kwargs=None):  # pylint: disable=unused-argument
    '''
    Get a resource type api versions
    '''
    if kwargs is None:
Severity: Minor
Found in salt/cloud/clouds/azurearm.py - About 35 mins 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 list_public_ips has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_public_ips(kwargs=None, call=None):
    '''
    List all available public IPs.

    CLI Example:
Severity: Minor
Found in salt/cloud/clouds/gogrid.py - About 35 mins 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 query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def query(conn_type, option, post_data=None):
    '''
    Execute the HTTP request to the API
    '''
    if ticket is None or csrf is None or url is None:
Severity: Minor
Found in salt/cloud/clouds/proxmox.py - About 35 mins 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 list_nodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_nodes():
    '''
    List virtual machines

      .. code-block:: bash
Severity: Minor
Found in salt/cloud/clouds/xen.py - About 35 mins 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_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_config(kwargs=None, call=None):
    '''
    Creates a Linode Configuration Profile.

    name
Severity: Minor
Found in salt/cloud/clouds/linode.py - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

def create(vm_):
    '''
    Create a single instance from a data dict.

    CLI Examples:
Severity: Minor
Found in salt/cloud/clouds/qingcloud.py - About 35 mins 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_group_estimate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_group_estimate(call=None, for_output=True, **kwargs):
    '''
    Return a list of the VMs that are on the provider
    usage: "salt-cloud -f get_group_estimate clc group=Dev location=VA1"
    '''
Severity: Minor
Found in salt/cloud/clouds/clc.py - About 35 mins 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 ping has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def ping():
    '''
    Returns True if connection is to be done via a vCenter (no connection is attempted).
    Check to see if the host is responding when connecting directly via an ESXi
    host.
Severity: Minor
Found in salt/proxy/esxi.py - About 35 mins 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 cmd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def cmd(fun, *args, **kwargs):
    '''
    .. versionchanged:: 2018.3.0
        Added ``with_pillar`` argument

Severity: Minor
Found in salt/runners/salt.py - About 35 mins 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 key_regen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def key_regen():
    '''
    This routine is used to regenerate all keys in an environment. This is
    invasive! ALL KEYS IN THE SALT ENVIRONMENT WILL BE REGENERATED!!

Severity: Minor
Found in salt/runners/manage.py - About 35 mins 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 __cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __cleanup(cls, expire):
        now = time.time()
        for storage in six.itervalues(cls.data):
            for key, data in list(storage.items()):
                if data[0] + expire < now:
Severity: Minor
Found in salt/cache/__init__.py - About 35 mins 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 show_pillar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def show_pillar(minion='*', **kwargs):
    '''
    Returns the compiled pillar either of a specific minion
    or just the global available pillars. This function assumes
    that no minion has the id ``*``.
Severity: Minor
Found in salt/runners/pillar.py - About 35 mins 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