saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _query has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _query(action=None,
           command=None,
           args=None,
           method='GET',
           header_dict=None,
Severity: Minor
Found in salt/cloud/clouds/linode.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 query has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def query(action=None,
          command=None,
          args=None,
          method='GET',
          location=None,
Severity: Minor
Found in salt/cloud/clouds/joyent.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 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def init(opts):
    '''
    This function gets called when the proxy starts up.
    For login the protocol and port are cached.
    '''
Severity: Minor
Found in salt/proxy/vcenter.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 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def init(opts):
    '''
    This function gets called when the proxy starts up.
    All login details are cached.
    '''
Severity: Minor
Found in salt/proxy/esxdatacenter.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 findmac has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def findmac(device=None, mac=None, interface=None, vlan=None, display=_DEFAULT_DISPLAY):
    '''
    Search in the MAC Address tables, using the following mine functions:

    - net.mac
Severity: Minor
Found in salt/runners/net.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_certs has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_certs(data):
    cert_mode = False
    cert = ''
    certs = []
    rsa_key = ''
Severity: Minor
Found in salt/runners/venafiapi.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 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def init(opts):
    '''
    This function gets called when the proxy starts up. For
    login
    the protocol and port are cached.
Severity: Minor
Found in salt/proxy/esxcluster.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 order_certificate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def order_certificate(minion_id, common_name, organization_id, validity_years,
                      cert_key_passphrase=None, signature_hash=None, key_len=2048,
                      dns_names=None, organization_units=None, server_platform=None,
                      custom_expiration_date=None, comments=None, disable_renewal_notifications=False,
                      product_type_hint=None, renewal_of_order_id=None):
Severity: Minor
Found in salt/runners/digicertapi.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 proxy_config has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def proxy_config(commands, **kwargs):
    '''
    Send configuration commands over SSH or NX-API

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

    def check_refresh(self, data, ret):
        '''
        Check to see if the modules for this state instance need to be updated,
        only update if the state is a file or a package and if it changed
        something. If the file function is managed check to see if the file is a
Severity: Minor
Found in salt/state.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 _freebsd_geom has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _freebsd_geom():
    geom = salt.utils.path.which('geom')
    ret = {'disks': {}, 'SSDs': []}

    devices = __salt__['cmd.run']('{0} disk list'.format(geom))
Severity: Minor
Found in salt/grains/disks.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 _windows_os_release_grain has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _windows_os_release_grain(caption, product_type):
    '''
    helper function for getting the osrelease grain
    :return:
    '''
Severity: Minor
Found in salt/grains/core.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 _clean_value has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _clean_value(key, val):
    '''
    Clean out well-known bogus values.
    If it isn't clean (for example has value 'None'), return None.
    Otherwise, return the original value.
Severity: Minor
Found in salt/grains/core.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 __event_handler has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def __event_handler(self, raw):
        if not self.event:
            return
        mtag, data = self.event.unpack(raw, self.event.serial)
        for (pattern, op) in self.event.patterns:
Severity: Minor
Found in salt/cli/batch_async.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 display_rows has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def display_rows(self,
                     rows,
                     labels,
                     indent):

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

def wait_lock(lk_fn, dest, wait_timeout=0):
    '''
    If the write lock is there, check to see if the file is actually being
    written. If there is no change in the file size after a short sleep,
    remove the lock and move forward.
Severity: Minor
Found in salt/fileserver/__init__.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 find_file has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def find_file(path, saltenv='base', **kwargs):
    '''
    Search the environment for the relative path.
    '''
    if 'env' in kwargs:
Severity: Minor
Found in salt/fileserver/roots.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 dir_list has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def dir_list(load):
    '''
    Return a list of all directories on the master

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

File heat.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Management of Heat
==================

Severity: Minor
Found in salt/states/heat.py - About 2 hrs to fix

    File batch.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Execute batch runs
    '''
    
    
    Severity: Minor
    Found in salt/cli/batch.py - About 2 hrs to fix
      Severity
      Category
      Status
      Source
      Language