saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def cmd_unzip(zip_file,
              dest,
              excludes=None,
              options=None,
              template=None,
Severity: Minor
Found in salt/modules/archive.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 show_queue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def show_queue():
    '''
    Show contents of the mail queue

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

def show(commands, raw_text=True, **kwargs):
    '''
    Execute one or more show (non-configuration) commands.

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

def status(name, sig=None):
    '''
    Return the status for a service via ssh_sample.
    If the name contains globbing, a dict mapping service name to True/False
    values is returned.
Severity: Minor
Found in salt/modules/ssh_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 install has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def install(name=None,
            refresh=False,
            fromrepo=None,
            pkgs=None,
            sources=None,
Severity: Minor
Found in salt/modules/freebsdpkg.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 _nxapi_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
    '''
    Helper function to send configuration commands using NX-API.
    '''
    api_kwargs = __salt__['config.get']('nxos', {})
Severity: Minor
Found in salt/modules/nxos.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 __write_docker_compose has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def __write_docker_compose(path, docker_compose, already_existed):
    '''
    Write docker-compose to a path
    in order to use it with docker-compose ( config check )

Severity: Minor
Found in salt/modules/dockercompose.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 packages currently installed as a dict::

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

def __virtual__():
    '''
    Only load this module if the psql bin exist.
    initdb bin might also be used, but its presence will be detected on runtime.
    '''
Severity: Minor
Found in salt/modules/postgres.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 _proxy_conf_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _proxy_conf_file(proxyfile, test):
    '''
    Check if proxy conf exists and update
    '''
    changes_old = []
Severity: Minor
Found in salt/modules/salt_proxy.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_metadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_metadata(name,
                    ext_version=None,
                    schema=None,
                    user=None,
                    host=None,
Severity: Minor
Found in salt/modules/postgres.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_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def remove_tags(TagKeys, DomainName=None, ARN=None,
           region=None, key=None, keyid=None, profile=None):
    '''
    Remove tags from a trail

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

def selinux_fs_path():
    '''
    Return the location of the SELinux VFS directory

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

def get_interface(iface):
    '''
    Return the contents of an interface script

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

def load_config(filename=None,
                text=None,
                test=False,
                commit=True,
                debug=False,
Severity: Minor
Found in salt/modules/napalm_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_var has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_var(var):
    '''
    Get the value of a variable in make.conf

    Return the value of the variable or None if the variable is not in
Severity: Minor
Found in salt/modules/makeconf.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_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _get_version(name, results):
    '''
    ``pkg search`` will return all packages for which the pattern is a match.
    Narrow this down and return the package version, or None if no exact match.
    '''
Severity: Minor
Found in salt/modules/pkgng.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 _parse_current_network_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_current_network_settings():
    '''
    Parse /etc/default/networking and return current configuration
    '''
    opts = salt.utils.odict.OrderedDict()
Severity: Minor
Found in salt/modules/debian_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 _lockcmd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _lockcmd(subcmd, pkgname=None, **kwargs):
    '''
    Helper function for lock and unlock commands, because their syntax is identical.

    Run the lock/unlock command, and return a list of locked packages
Severity: Minor
Found in salt/modules/pkgng.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 modules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def modules():
    '''
    Return list of static and shared modules (``apachectl -M``)

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