saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _transform_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _transform_value(value, policy, transform_type):
    '''
    helper function to transform the policy value into something that more
    closely matches how the policy is displayed in the gpedit GUI
    '''
Severity: Minor
Found in salt/modules/win_lgpo.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 _collect_results has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _collect_results(func, item, args, marker='Marker', nextmarker='NextMarker'):
    ret = []
    Marker = args.get(marker, '')
    tries = 10
    while Marker is not None:
Severity: Minor
Found in salt/modules/boto3_route53.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 remove has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def remove(name=None, pkgs=None, **kwargs):
    '''
    name
        The name of the package to be deleted.

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

def _merge_list_of_dict(first, second, prepend=True):
    '''
    Merge lists of dictionaries.
    Each element of the list is a dictionary having one single key.
    That key is then used as unique lookup.
Severity: Minor
Found in salt/modules/capirca_acl.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_object has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _get_policy_object(platform,
                       filters=None,
                       pillar_key='acl',
                       pillarenv=None,
                       saltenv=None,
Severity: Minor
Found in salt/modules/capirca_acl.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 upgrade has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(bin_env=None,
            user=None,
            cwd=None,
            use_vt=False):
    '''
Severity: Minor
Found in salt/modules/pip.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 file_dict has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def file_dict(*packages, **kwargs):
    '''
    .. versionchanged: 2016.3.0

    List the files that belong to a package.
Severity: Minor
Found in salt/modules/pkgin.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 config_ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def config_(dev=None, **kwargs):
    '''
    Show or update config of a bcache device.

    If no device is given, operate on the cache set itself.
Severity: Minor
Found in salt/modules/bcache.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_pkgs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def list_pkgs(versions_as_list=False, with_origin=False, **kwargs):
    '''
    List the packages currently installed as a dict::

        {'<package_name>': '<version>'}
Severity: Minor
Found in salt/modules/freebsdpkg.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_zones has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def list_zones(permanent=True):
    '''
    List everything added for or enabled in all zones

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

def delete_rule(name=None,
                localport=None,
                protocol=None,
                dir=None,
                remoteip=None):
Severity: Minor
Found in salt/modules/win_firewall.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 _change_state has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _change_state(interface, new_state):
    '''
    Enable or disable an interface

    Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.
Severity: Minor
Found in salt/modules/nilrt_ip.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_possible_adapter_modes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _get_possible_adapter_modes(interface, blacklist):
    '''
    Return possible adapter modes for a given interface using a blacklist.

    :param interface: interface name
Severity: Minor
Found in salt/modules/nilrt_ip.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 back_make has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def back_make(dev, cache_mode='writeback', force=False, attach=True, bucket_size=None):
    '''
    Create a backing device for attachment to a set.
    Because the block size must be the same, a cache set already needs to exist.

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

def _gem(command, ruby=None, runas=None, gem_bin=None):
    '''
    Run the actual gem command. If rvm or rbenv is installed, run the command
    using the corresponding module. rbenv is not available on windows, so don't
    try.
Severity: Minor
Found in salt/modules/gem.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 _validate_sleep has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _validate_sleep(minutes):
    '''
    Helper function that validates the minutes parameter. Can be any number
    between 1 and 180. Can also be the string values "Never" and "Off".

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

def pause(path, service_names=None):
    '''
    Pause running containers in the docker-compose file, service_names is a python
    list, if omitted pause all containers

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

def _run_initdb(name,
        auth='password',
        user=None,
        password=None,
        encoding='UTF8',
Severity: Minor
Found in salt/modules/postgres.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 latest_version has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def latest_version(*names, **kwargs):
    '''
    Return the latest version of the named package available for upgrade or
    installation. If more than one package name is specified, a dict of
    name/version pairs is returned.
Severity: Minor
Found in salt/modules/xbpspkg.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_backend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_backend(backend, socket=DEFAULT_SOCKET_URL):
    '''

    Receive information about a specific backend.

Severity: Minor
Found in salt/modules/haproxyconn.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