saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def _parse_routes():
    '''
    Parse the contents of ``/proc/net/route``
    '''
    with salt.utils.files.fopen('/proc/net/route', 'r') as fp_:
Severity: Minor
Found in salt/modules/linux_ip.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 netstat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def netstat():
    '''
    Return information on open ports and states

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

def _get_buildout_ver(directory='.'):
    '''Check for buildout versions.

    In any cases, check for a version pinning
    Also check for buildout.dumppickedversions which is buildout1 specific
Severity: Minor
Found in salt/modules/zcbuildout.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_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def check_hash(path, file_hash):
    '''
    Check if a file matches the given hash string

    Returns ``True`` if the hash matches, otherwise ``False``.
Severity: Minor
Found in salt/modules/file.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 contains_regex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def contains_regex(path, regex, lchar=''):
    '''
    .. deprecated:: 0.17.0
       Use :func:`search` instead.

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

def check_managed(
        name,
        source,
        source_hash,
        source_hash_name,
Severity: Minor
Found in salt/modules/file.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_account_policy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _get_account_policy(name):
    '''
    Get the entire accountPolicy and return it as a dictionary. For use by this
    module only

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

def start(name, timeout=90, with_deps=False, with_parents=False):
    '''
    Start the specified service.

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

def ping(host, timeout=False, return_boolean=False):
    '''
    Performs a ping to a host

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

def _update_element(name, element_type, data, server=None):
    '''
    Update an element, including it's properties
    '''
    # Urlencode the name (names may have slashes)
Severity: Minor
Found in salt/modules/glassfish.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 passwd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def passwd(passwd,
           user='',
           alg='sha1',
           realm=None):
    '''
Severity: Minor
Found in salt/modules/tomcat.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_inactive_vms has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def list_inactive_vms(cwd=None):
    '''
    Return a list of machine names for inactive virtual machine on the host,
    which are defined in the Vagrantfile at the indicated path.

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

def rm_known_host(user=None, hostname=None, config=None, port=None):
    '''
    Remove all keys belonging to hostname from a known_hosts file.

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

def _refine_enc(enc):
    '''
    Return the properly formatted ssh value for the authorized encryption key
    type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string
    if using higher enc. If the type is not found, raise CommandExecutionError.
Severity: Minor
Found in salt/modules/ssh.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_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _create_element(name, element_type, data, server=None):
    '''
    Create a new element
    '''
    # Define property and id from name and properties + remove SaltStack parameters
Severity: Minor
Found in salt/modules/glassfish.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_top_file_envs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _get_top_file_envs():
    '''
    Get all environments from the top file
    '''
    try:
Severity: Minor
Found in salt/modules/saltutil.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 _normalize_multiple_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _normalize_multiple_name(self, references, *differences):
        # Normalize Input
        ret = list()
        for difference in differences:
            difference_str = str(difference)
Severity: Minor
Found in salt/modules/win_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 _parents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _parents(self, name):
        # Using a list here to maintain order
        ret = list()
        try:
            # Sort for predictable behavior
Severity: Minor
Found in salt/modules/win_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 _sync has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):
    '''
    Sync the given directory in the given environment
    '''
    if saltenv is None:
Severity: Minor
Found in salt/modules/saltutil.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_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def apply_config(path, source=None, salt_env='base'):
    r'''
    Run an compiled DSC configuration (a folder containing a .mof file). The
    folder can be cached from the salt master using the ``source`` option.

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