saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def session_list(consul_url=None, token=None, return_list=False, **kwargs):
    '''
    Used to list sessions.

    :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 session_destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def session_destroy(consul_url=None, token=None, session=None, **kwargs):
    '''
    Destroy session

    :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 _usage_overall has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _usage_overall(raw):
    '''
    Parse usage/overall.
    '''
    data = {}
Severity: Minor
Found in salt/modules/btrfs.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_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_user(username, password, permissions, users=None):
    '''
    Create user accounts

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

def agent_check_warn(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 warning 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

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

def health_service(consul_url=None, token=None, service=None, **kwargs):
    '''
    Health information about the registered service.

    :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 agent_check_pass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def agent_check_pass(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 passing 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

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

def remove_rule(method,
                ip,
                port=None,
                proto='tcp',
                direction='in',
Severity: Minor
Found in salt/modules/csf.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 enable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def enable(name, no_block=False, unmask=False, unmask_runtime=False,
           root=None, **kwargs):  # pylint: disable=unused-argument
    '''
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
Severity: Minor
Found in salt/modules/systemd_service.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_role_policy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_role_policy(role_name, policy_name, policy, region=None, key=None,
                       keyid=None, profile=None):
    '''
    Create or modify a role policy.

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

def _do_http(opts, profile='default'):
    '''
    Make the http request and return the data
    '''

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

def get_group_members(group_name, region=None, key=None, keyid=None, profile=None):
    '''
    Get group information.

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

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

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

def _get_service_exec():
    '''
    Returns the path to the sysv service manager (either update-rc.d or
    chkconfig)
    '''
Severity: Minor
Found in salt/modules/systemd_service.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_host has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def delete_host(mac=None, name=None):
    '''
    Delete the host with the given mac or name.

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

def _try_path(dir, rel, lpaths):
    if not rel:
        raise RuntimeError('Got invalid filename (empty string).')
    if rel[-1] == '/':
        raise RuntimeError('Attempted to import a directory')
Severity: Minor
Found in salt/modules/jsonnet.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 flush has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def flush(modifier):
    '''
    Flush the specified packet filter parameters.

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

def get_pkg_id(pkg):
    '''
    Attempt to get the package ID from a .pkg file

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

def tune(device, **kwargs):
    '''
    Set attributes for the specified device (using tune2fs)

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

def _complete_transaction(cleanup_only, recursive, max_attempts, run_count, cmd_ret_list):
    '''
    .. versionadded:: Fluorine

    Called from ``complete_transaction`` to protect the arguments
Severity: Minor
Found in salt/modules/yumpkg.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