saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def is_text(fp_, blocksize=512):
    '''
    Uses heuristics to guess whether the given file is text or binary,
    by reading a single block of bytes from the file.
    If more than 30% of the chars in the block are non-text, or there
Severity: Minor
Found in salt/utils/files.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_client has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_client(client_type, **kwargs):
    '''
    Dynamically load the selected client and return a management client object
    '''
    client_map = {'compute': 'ComputeManagement',
Severity: Minor
Found in salt/utils/azurearm.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_diskgroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def remove_diskgroup(service_instance, host_ref, diskgroup, hostname=None,
                     host_vsan_system=None, erase_disk_partitions=False,
                     data_accessibility=True):
    '''
    Removes a disk group.
Severity: Minor
Found in salt/utils/vsan.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_product_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_product_value(self, value_name, wanted_type=None):
        '''
        For the product section of the registry return the name value.

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

def unique(values):
    '''
    Removes duplicates from a list.

    .. code-block:: jinja
Severity: Minor
Found in salt/utils/jinja.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 _add_option has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _add_option(self, sectdict, key, value):
        if isinstance(value, list):
            sectdict[key] = value
        elif isinstance(value, six.string_types):
            try:
Severity: Minor
Found in salt/utils/configparser.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_time has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def install_time(self):
        '''
        Return the install time, or provide an estimate of install time.

        Installers or even self upgrading software must/should update the date
Severity: Minor
Found in salt/utils/pkg/win.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_checkout_target has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_checkout_target(self):
        '''
        Resolve dynamically-set branch
        '''
        if self.role == 'git_pillar' and self.branch == '__env__':
Severity: Minor
Found in salt/utils/gitfs.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_capacity_from_diskgroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def remove_capacity_from_diskgroup(service_instance, host_ref, diskgroup,
                                   capacity_disks, data_evacuation=True,
                                   hostname=None,
                                   host_vsan_system=None):
    '''
Severity: Minor
Found in salt/utils/vsan.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 __ip_addr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def __ip_addr(addr, address_family=socket.AF_INET):
    '''
    Returns True if the IP address (and optional subnet) are valid, otherwise
    returns False.
    '''
Severity: Minor
Found in salt/utils/validate/net.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 __version_capture_slp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __version_capture_slp(self, pkg_id, version_binary, version_display, display_name):
        '''
        This returns the version and where the version string came from, based on instructions
        under ``version_capture``, if ``version_capture`` is missing, it defaults to
        value of display-version.
Severity: Minor
Found in salt/utils/pkg/win.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 version_to_evr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def version_to_evr(verstring):
    '''
    Split the package version string into epoch, version and release.
    Return this as tuple.

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

def chugid_and_umask(runas, umask, group=None):
    '''
    Helper method for for subprocess.Popen to initialise uid/gid and umask
    for the new process.
    '''
Severity: Minor
Found in salt/utils/user.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_uid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_uid(user=None):
    '''
    Get the uid for a given user name. If no user given, the current euid will
    be returned. If the user does not exist, None will be returned. On systems
    which do not support pwd or os.geteuid, None will be returned.
Severity: Minor
Found in salt/utils/user.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_gid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_gid(group=None):
    '''
    Get the gid for a given group name. If no group given, the current egid
    will be returned. If the group does not exist, None will be returned. On
    systems which do not support grp or os.getegid it will return None.
Severity: Minor
Found in salt/utils/user.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 volume_create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def volume_create(name, size=None):
    '''

    Create a volume on a Pure Storage FlashArray.

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

def put_parameter(Name,
                  Value,
                  Description=None,
                  Type='String',
                  KeyId=None,
Severity: Minor
Found in salt/modules/boto_ssm.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 pem_finger has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def pem_finger(path=None, key=None, sum_type='sha256'):
    '''
    Pass in either a raw pem string, or the path on disk to the location of a
    pem file, and the type of cryptographic hash to use. The default is SHA256.
    The fingerprint of the pem will be returned.
Severity: Minor
Found in salt/utils/crypt.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_args_and_kwargs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_args_and_kwargs(self, cmdline):
        '''
        cmdline: list

        returns tuple of: args (list), kwargs (dict)
Severity: Minor
Found in salt/engines/slack.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 _command_event has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _command_event(self, event):
        if __opts__.get('__role') == 'master':
            fire_master = salt.utils.event.get_master_event(__opts__, __opts__['sock_dir']).fire_event
        else:
            fire_master = None
Severity: Minor
Found in salt/engines/ircbot.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