saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function highstate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def highstate(test=None, queue=False, **kwargs):
    '''
    Retrieve the state data from the salt master for this minion and execute it

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

def check(set=None, entry=None, family='ipv4'):
    '''
    Check that an entry exists in the specified set.

    set
Severity: Minor
Found in salt/modules/ipset.py - About 1 hr 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 version has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def version(versioninfo=False):
    '''
    .. versionadded:: 2015.8.0

    Returns the version of Git installed on the minion
Severity: Minor
Found in salt/modules/git.py - About 1 hr 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 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def delete(name, skip_final_snapshot=None, final_db_snapshot_identifier=None,
           region=None, key=None, keyid=None, profile=None, tags=None,
           wait_for_deletion=True, timeout=180):
    '''
    Delete an RDS instance.
Severity: Minor
Found in salt/modules/boto_rds.py - About 1 hr 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_operation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def run_operation(jboss_config, operation, fail_on_error=True, retries=1):
    '''
    Execute an operation against jboss instance through the CLI interface.

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

def get(**kwargs):
    '''
    Return system rc configuration variables

    CLI Example:
Severity: Minor
Found in salt/modules/sysrc.py - About 1 hr 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 _apply_dvs_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _apply_dvs_config(config_spec, config_dict):
    '''
    Applies the values of the config dict dictionary to a config spec
    (vim.VMwareDVSConfigSpec)
    '''
Severity: Minor
Found in salt/modules/vsphere.py - About 1 hr 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 _apply_serial_port has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _apply_serial_port(serial_device_spec, key, operation='add'):
    '''
    Returns a vim.vm.device.VirtualSerialPort representing a serial port
    component

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

def _apply_dvs_network_resource_pools(network_resource_pools, resource_dicts):
    '''
    Applies the values of the resource dictionaries to network resource pools,
    creating the resource pools if required
    (vim.DVSNetworkResourcePoolConfigSpec)
Severity: Minor
Found in salt/modules/vsphere.py - About 1 hr 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_datastores_via_proxy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def list_datastores_via_proxy(datastore_names=None, backing_disk_ids=None,
                              backing_disk_scsi_addresses=None,
                              service_instance=None):
    '''
    Returns a list of dict representations of the datastores visible to the
Severity: Minor
Found in salt/modules/vsphere.py - About 1 hr 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_policy_dict has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _get_policy_dict(policy):
    '''Returns a dictionary representation of a policy'''
    profile_dict = {'name': policy.name,
                    'description': policy.description,
                    'resource_type': policy.resourceType.resourceType}
Severity: Minor
Found in salt/modules/vsphere.py - About 1 hr 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 _apply_advanced_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _apply_advanced_config(config_spec, advanced_config, vm_extra_config=None):
    '''
    Sets configuration parameters for the vm

    config_spec
Severity: Minor
Found in salt/modules/vsphere.py - About 1 hr 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 container_create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def container_create(name, source, profiles=None,
                     config=None, devices=None, architecture='x86_64',
                     ephemeral=False, wait=True,
                     remote_addr=None, cert=None, key=None, verify_cert=True,
                     _raw=False):
Severity: Minor
Found in salt/modules/lxd.py - About 1 hr 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_table has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def create_table(table_name, region=None, key=None, keyid=None, profile=None,
                 read_capacity_units=None, write_capacity_units=None,
                 hash_key=None, hash_key_data_type=None, range_key=None,
                 range_key_data_type=None, local_indexes=None,
                 global_indexes=None):
Severity: Minor
Found in salt/modules/boto_dynamodb.py - About 1 hr 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_sysv_services has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _get_sysv_services(root, systemd_services=None):
    '''
    Use os.listdir() and os.access() to get all the initscripts
    '''
    initscript_path = _root(INITSCRIPT_PATH, root)
Severity: Minor
Found in salt/modules/systemd_service.py - About 1 hr 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_ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def list_():
    '''
    Return a list of accepted, denied, unaccepted and rejected keys.
    This is the same output as `salt-key -L`

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

def add(name, mac, mtu=1500):
    '''
    Add a new nictag

    name : string
Severity: Minor
Found in salt/modules/smartos_nictagadm.py - About 1 hr 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_hold has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _get_hold(line, pattern=__HOLD_PATTERN, full=True):
    '''
    Resolve a package name from a line containing the hold expression. If the
    regex is not matched, None is returned.

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

def __execute_cmd(name, xml):
    '''
    Execute ilom commands
    '''
    ret = {name.replace('_', ' '): {}}
Severity: Minor
Found in salt/modules/ilo.py - About 1 hr 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 save_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def save_config():
    '''
    Save RAID configuration to config file.

    Same as:
Severity: Minor
Found in salt/modules/mdadm_raid.py - About 1 hr 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