saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function show_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def show_instance(name, session=None, call=None):
    '''
    Show information about a specific VM or template

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

def put_blob(kwargs=None, storage_conn=None, call=None):
    '''
    .. versionadded:: 2015.8.0

    Upload a blob
Severity: Minor
Found in salt/cloud/clouds/msazure.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

def _query(action=None,
           command=None,
           args=None,
           method='GET',
           header_dict=None,
Severity: Minor
Found in salt/cloud/clouds/gogrid.py - About 25 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_blob has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_blob(kwargs=None, storage_conn=None, call=None):
    '''
    .. versionadded:: 2015.8.0

    Download a blob
Severity: Minor
Found in salt/cloud/clouds/msazure.py - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def destroy(name, call=None):
    '''
    Destroy a node.

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

def post_dns_record(**kwargs):
    '''
    Creates a DNS record for the given name if the domain is managed with DO.
    '''
    if 'kwargs' in kwargs:  # flatten kwargs if called via salt-cloud -f
Severity: Minor
Found in salt/cloud/clouds/digitalocean.py - About 25 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_custom_images has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def list_custom_images(call=None):
    '''
    Return a dict of all custom VM images on the cloud provider.
    '''
    if call != 'function':
Severity: Minor
Found in salt/cloud/clouds/softlayer.py - About 25 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 set_vm_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def set_vm_status(status, name=None, vmid=None):
    '''
    Convenience function for setting VM status
    '''
    log.debug('Set status to %s for %s (%s)', status, name, vmid)
Severity: Minor
Found in salt/cloud/clouds/proxmox.py - About 25 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_blob_properties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def show_blob_properties(kwargs=None, storage_conn=None, call=None):
    '''
    .. versionadded:: 2015.8.0

    Returns all user-defined metadata, standard HTTP properties, and
Severity: Minor
Found in salt/cloud/clouds/msazure.py - About 25 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 wait_for_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def wait_for_state(vmid, state, timeout=300):
    '''
    Wait until a specific state has been reached on a node
    '''
    start_time = time.time()
Severity: Minor
Found in salt/cloud/clouds/proxmox.py - About 25 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_passwords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def list_passwords(kwargs=None, call=None):
    '''
    List all password on the account

    .. versionadded:: 2015.8.0
Severity: Minor
Found in salt/cloud/clouds/gogrid.py - About 25 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 _compute_signature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _compute_signature(parameters, access_key_secret):
    '''
    Generate aliyun request signature
    '''

Severity: Minor
Found in salt/cloud/clouds/aliyun.py - About 25 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 avail_locations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def avail_locations(call=None):
    '''
    Return a dict of all available regions.
    '''
    if call == 'action':
Severity: Minor
Found in salt/cloud/clouds/azurearm.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

def list_nodes(call=None):
    '''
    Return a list of the VMs that are on the provider
    '''
    if call == 'action':
Severity: Minor
Found in salt/cloud/clouds/parallels.py - About 25 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_full has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def list_nodes_full(call=None):
    '''
    Return a list of the VMs that are on the provider
    '''
    if call == 'action':
Severity: Minor
Found in salt/cloud/clouds/parallels.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):
    '''
    Make a web call to DigitalOcean
    '''
    base_path = six.text_type(config.get_cloud_config_value(
Severity: Minor
Found in salt/cloud/clouds/digitalocean.py - About 25 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 _rpc_file_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _rpc_file_list(dev):
    try:
        dev.rpc.file_list(path='/dev/null', dev_timeout=5)
        return True
    except (RpcTimeoutError, ConnectClosedError):
Severity: Minor
Found in salt/proxy/junos.py - About 25 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_pool_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _get_pool_results(*args, **kwargs):
    '''
    A helper function which returns a dictionary of minion pools along with
    their matching result sets.
    Useful for developing other "survey style" functions.
Severity: Minor
Found in salt/runners/survey.py - About 25 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 call_brightness has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def call_brightness(*args, **kwargs):
    '''
    Set an effect to the lamp.

    Arguments:
Severity: Minor
Found in salt/proxy/philips_hue.py - About 25 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 post_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def post_event(event,
               channel=None,
               username=None,
               api_url=None,
               hook=None):
Severity: Minor
Found in salt/runners/mattermost.py - About 25 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