saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def node(name, **kwargs):
    '''
    Return the details of the node identified by the specified name

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

def replace_secret(name,
                   data,
                   source=None,
                   template=None,
                   saltenv='base',
Severity: Minor
Found in salt/modules/kubernetesmod.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 _set_syslog_config_helper has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _set_syslog_config_helper(host, username, password, syslog_config, config_value,
                              protocol=None, port=None, reset_service=None, esxi_host=None, credstore=None):
    '''
    Helper function for set_syslog_config that sets the config and populates the return dictionary.
    '''
Severity: Minor
Found in salt/modules/vsphere.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_upgrades has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_upgrades(refresh=True, root=None, **kwargs):
    '''
    List all available package upgrades on this system

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

def _apply_network_adapter_config(key, network_name, adapter_type, switch_type,
                                  network_adapter_label=None, operation='add',
                                  connectable=None, mac=None, parent=None):
    '''
    Returns a vim.vm.device.VirtualDeviceSpec object specifying to add/edit a
Severity: Minor
Found in salt/modules/vsphere.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_all has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_all():
    '''
    Lists all ports available.

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

def create_secret(
        name,
        namespace='default',
        data=None,
        source=None,
Severity: Minor
Found in salt/modules/kubernetesmod.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 _clean_cache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _clean_cache():
    '''
    Clean cached results
    '''
    keys = []
Severity: Minor
Found in salt/modules/zypperpkg.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 _needs_change has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _needs_change(old, new):
    if old != new:
        if new == 'random':
            # Allow switch from '*' or not present to 'random'
            if old == '*':
Severity: Minor
Found in salt/modules/cron.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 del_repo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def del_repo(repo, root=None):
    '''
    Delete a repo.

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

def create_diskgroup(cache_disk_id, capacity_disk_ids, safety_checks=True,
                     service_instance=None):
    '''
    Creates disk group on an ESXi host with the specified cache and
    capacity disks.
Severity: Minor
Found in salt/modules/vsphere.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_dvss has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_dvss(datacenter=None, dvs_names=None, service_instance=None):
    '''
    Returns a list of distributed virtual switches (DVSs).
    The list can be filtered by the datacenter or DVS names.

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

def get_vm_config_file(name, datacenter, placement, datastore,
                       service_instance=None):
    '''
    Queries the virtual machine config file and returns
    vim.host.DatastoreBrowser.SearchResults object on success None on failure
Severity: Minor
Found in salt/modules/vsphere.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 _convert_units has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _convert_units(devices):
    '''
    Updates the size and unit dictionary values with the new unit values

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

def check_valid_package(package,
                        cyg_arch='x86_64',
                        mirrors=None):
    '''
    Check if the package is valid on the given mirrors.
Severity: Minor
Found in salt/modules/cyg.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def update(extract=False):
    '''
    Update the ports tree

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

def agent_join(consul_url=None, token=None, address=None, **kwargs):
    '''
    Triggers the local agent to join a node

    :param consul_url: The Consul server URL.
Severity: Minor
Found in salt/modules/consul.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 _prepare_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _prepare_settings(pspath, settings):
    '''
    Prepare settings before execution with get or set functions.
    Removes settings with a match parameter when index is not found.
    '''
Severity: Minor
Found in salt/modules/win_iis.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 config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def config(commands=None,
           config_file=None,
           template_engine='jinja',
           context=None,
           defaults=None,
Severity: Minor
Found in salt/modules/arista_pyeapi.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 agent_check_fail has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def agent_check_fail(consul_url=None, token=None, checkid=None, **kwargs):
    '''
    This endpoint is used with a check that is of the TTL type. When this
    is called, the status of the check is set to critical and the
    TTL clock is reset.
Severity: Minor
Found in salt/modules/consul.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