saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _set_netsh_value has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _set_netsh_value(profile, section, option, value):
    if section not in ('firewallpolicy', 'settings', 'logging', 'state'):
        raise ValueError('LGPO: Invalid section: {0}'.format(section))
    log.debug('LGPO: Setting the following\n'
              'Profile: %s\n'
Severity: Minor
Found in salt/modules/win_lgpo.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 set_password has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def set_password(name, password, use_usermod=False, root=None):
    '''
    Set the password for a named user. The password must be a properly defined
    hash. The password hash can be generated with this command:

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

def list_all_versions(pkg,
                      bin_env=None,
                      include_alpha=False,
                      include_beta=False,
                      include_rc=False,
Severity: Minor
Found in salt/modules/pip.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 _revision_tag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _revision_tag(text,
                  revision_id=None,
                  revision_no=None,
                  revision_date=True,
                  revision_date_format='%Y/%m/%d'):
Severity: Minor
Found in salt/modules/capirca_acl.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 make_src_pkg has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def make_src_pkg(dest_dir, spec, sources, env=None, saltenv='base', runas='root'):
    '''
    Create a platform specific source package from the given platform spec/control file and sources

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

def _bsd_brshow(br=None):
    '''
    Internal, returns bridges and member interfaces (BSD-like: ifconfig)
    '''
    if __grains__['kernel'] == 'NetBSD':
Severity: Minor
Found in salt/modules/bridge.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 add_test_files_for_sls has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def add_test_files_for_sls(self, sls_name, check_all=False):
        '''
        Adding test files
        '''
        sls_split = sls_name.rpartition('.')
Severity: Minor
Found in salt/modules/saltcheck.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 default_privileges_grant has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def default_privileges_grant(name,
        object_name,
        object_type,
        defprivileges=None,
        grant_option=None,
Severity: Minor
Found in salt/modules/postgres.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 persist has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def persist(name, value, config='/etc/sysctl.conf'):
    '''
    Assign and persist a simple sysctl parameter for this minion

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

    def refresh(self, inicontents=None):
        comment_count = 1
        unknown_count = 1
        curr_indent = ''
        inicontents = inicontents or self.inicontents
Severity: Minor
Found in salt/modules/ini_manage.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 setenforce has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def setenforce(mode):
    '''
    Set the SELinux enforcing mode

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

def privileges_grant(name,
        object_name,
        object_type,
        privileges=None,
        grant_option=None,
Severity: Minor
Found in salt/modules/postgres.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_apply_policy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def fcontext_apply_policy(name, recursive=False):
    '''
    .. versionadded:: 2017.7.0

    Applies SElinux policies to filespec using `restorecon [-R]
Severity: Minor
Found in salt/modules/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 default_privileges_list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def default_privileges_list(
        name,
        object_type,
        prepend='public',
        maintenance_db=None,
Severity: Minor
Found in salt/modules/postgres.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 privileges_list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def privileges_list(
        name,
        object_type,
        prepend='public',
        maintenance_db=None,
Severity: Minor
Found in salt/modules/postgres.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 list_upgrades has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def list_upgrades(refresh=False, root=None, **kwargs):  # pylint: disable=W0613
    '''
    List all available package upgrades on this system

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

def persist(name, value, config='/etc/sysctl.conf'):
    '''
    Assign and persist a simple sysctl parameter for this minion

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

def create_keyspace(keyspace, replication_strategy='SimpleStrategy', replication_factor=1, replication_datacenters=None,
                    contact_points=None, port=None, cql_user=None, cql_pass=None):
    '''
    Create a new keyspace in Cassandra.

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

def _nic_profile(profile_name, hypervisor, dmac=None):
    '''
    Compute NIC data based on profile
    '''

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

def _get_pkg_build_time(name):
    '''
    Get package build time, if possible.

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