saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def present(email, profile="splunk", **kwargs):
    '''
    Ensure a user is present

    .. code-block:: yaml
Severity: Minor
Found in salt/states/splunk.py - About 2 hrs 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 ring has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def ring(name, **kwargs):
    '''
    Manage rx/tx ring parameters of network device

    Use 'max' word to set with factory maximum
Severity: Minor
Found in salt/states/ethtool.py - About 2 hrs 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 present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def present(name,
            protocol=None,
            service_address=None,
            server_address=None,
            packet_forward_method='dr',
Severity: Minor
Found in salt/states/lvs_server.py - About 2 hrs 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 genrepo has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def genrepo(name, force=False, allow_empty=False):
    '''
    Refresh the winrepo.p file of the repository (salt-run winrepo.genrepo)

    If ``force`` is ``True`` no checks will be made and the repository will be
Severity: Minor
Found in salt/states/winrepo.py - About 2 hrs 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 managed has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def managed(name, probes, defaults=None):

    '''
    Ensure the networks device is configured as specified in the state SLS file.
    Probes not specified will be removed, while probes not confiured as expected will trigger config updates.
Severity: Minor
Found in salt/states/probes.py - About 2 hrs 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 _dashboard_diff has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def _dashboard_diff(_new_dashboard, _old_dashboard):
    '''Return a dictionary of changes between dashboards.'''
    diff = {}

    # Dashboard diff
Severity: Minor
Found in salt/states/grafana4_dashboard.py - About 2 hrs 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 _dashboard_diff has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def _dashboard_diff(_new_dashboard, _old_dashboard):
    '''Return a dictionary of changes between dashboards.'''
    diff = {}

    # Dashboard diff
Severity: Minor
Found in salt/states/grafana_dashboard.py - About 2 hrs 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 fcontext_policy_present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def fcontext_policy_present(name, sel_type, filetype='a', sel_user=None, sel_level=None):
    '''
    .. versionadded:: 2017.7.0

    Makes sure a SELinux policy for a given filespec (name), filetype
Severity: Minor
Found in salt/states/selinux.py - About 2 hrs 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_user_organizations has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def _update_user_organizations(user_name, user_id, organizations, ret, profile):
    for org in organizations.items():
        org_name, org_role = org if isinstance(org, tuple) and len(org) == 2 else (org, 'Viewer')
        try:
            org_users = __salt__['grafana4.get_org_users'](org_name, profile)
Severity: Minor
Found in salt/states/grafana4_user.py - About 2 hrs 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 community_names has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def community_names(name, communities=None):
    '''
    Manage the SNMP accepted community names and their permissions.

    :param str communities: A dictionary of SNMP communities and permissions.
Severity: Minor
Found in salt/states/win_snmp.py - About 2 hrs 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 fstab_absent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab'):
    '''
    Makes sure that a fstab mount point is absent.

    name
Severity: Minor
Found in salt/states/mount.py - About 2 hrs 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 pipeline_present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def pipeline_present(name, definition):
    '''
    Ensure that the named pipeline is present.

    name
Severity: Minor
Found in salt/states/elasticsearch.py - About 2 hrs 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 manage_node has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def manage_node(hostname, username, password, name, address,
                connection_limit=None,
                description=None,
                dynamic_ratio=None,
                logging=None,
Severity: Minor
Found in salt/states/bigip.py - About 2 hrs 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_vmconfig has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_vmconfig(config, instances):
    '''
    Parse vm_present vm config
    '''
    vmconfig = None
Severity: Minor
Found in salt/states/smartos.py - About 2 hrs 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_perms_changes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def _check_perms_changes(name, newperms, runas=None, existing=None):
    '''
    Check whether Rabbitmq user's permissions need to be changed.
    '''
    if not newperms:
Severity: Minor
Found in salt/states/rabbitmq_user.py - About 2 hrs 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 _init_auth has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def _init_auth(self):
        if self.auth:
            return

        low = {}
Severity: Minor
Found in salt/key.py - About 2 hrs 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 _mixin_before_exit has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def _mixin_before_exit(self):
        if hasattr(self, 'config') and self.config.get('pidfile'):
            # We've loaded and merged options into the configuration, it's safe
            # to query about the pidfile
            if self.check_pidfile():
Severity: Minor
Found in salt/utils/parsers.py - About 2 hrs 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 encode_list has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def encode_list(data, encoding=None, errors='strict', keep=False,
                preserve_dict_class=False, preserve_tuples=False):
    '''
    Encode all string values to bytes
    '''
Severity: Minor
Found in salt/utils/data.py - About 2 hrs 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 gen_keys_signature has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def gen_keys_signature(self, priv, pub, signature_path, auto_create=False, keysize=None):
        '''
        Generate master public-key-signature
        '''
        # check given pub-key
Severity: Minor
Found in salt/key.py - About 2 hrs 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 wait_for_passwd has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def wait_for_passwd(host, port=22, ssh_timeout=15, username='root',
                    password=None, key_filename=None, maxtries=15,
                    trysleep=1, display_ssh_output=True, gateway=None,
                    known_hosts_file='/dev/null', hard_timeout=None):
    '''
Severity: Minor
Found in salt/utils/cloud.py - About 2 hrs 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