saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function ip_addrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def ip_addrs(interface=None, include_loopback=False, cidr=None, type=None):
    '''
    Returns a list of IPv4 addresses assigned to the host.

    interface
Severity: Minor
Found in salt/modules/win_network.py - About 25 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 _select_kwargs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _select_kwargs(**kwargs):
    paramiko_kwargs = {}
    scp_kwargs = {}
    PARAMIKO_KWARGS, _, _, _ = inspect.getargspec(paramiko.SSHClient.connect)
    PARAMIKO_KWARGS.pop(0)  # strip self
Severity: Minor
Found in salt/modules/scp_mod.py - About 25 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_wait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _status_wait(service_name, end_time, service_states):
    '''
    Helper function that will wait for the status of the service to match the
    provided status before an end time expires. Used for service stop and start

Severity: Minor
Found in salt/modules/win_service.py - About 25 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_extmods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def list_extmods():
    '''
    .. versionadded:: 2017.7.0

    List Salt modules which have been synced externally
Severity: Minor
Found in salt/modules/saltutil.py - About 25 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_admin_object_resource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_admin_object_resource(name, server=None, **kwargs):
    '''
    Create a JMS destination
    '''
    defaults = {
Severity: Minor
Found in salt/modules/glassfish.py - About 25 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 _fingerprint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _fingerprint(public_key, fingerprint_hash_type):
    '''
    Return a public key fingerprint based on its base64-encoded representation

    The fingerprint string is formatted according to RFC 4716 (ch.4), that is,
Severity: Minor
Found in salt/modules/ssh.py - About 25 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_capirca_platform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _get_capirca_platform():  # pylint: disable=too-many-return-statements
    '''
    Given the following NAPALM grains, we can determine the Capirca platform name:

    - vendor
Severity: Minor
Found in salt/modules/napalm_netacl.py - About 25 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_api_method_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_api_method_response(restApiId, resourcePath, httpMethod, statusCode, responseParameters=None,
                               responseModels=None, region=None, key=None, keyid=None, profile=None):
    '''
    Create API method response for a method on a given resource in the given API

Severity: Minor
Found in salt/modules/boto_apigateway.py - About 25 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 maybe_fix_ssl_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def maybe_fix_ssl_version(ca_name, cacert_path=None, ca_filename=None):
    '''
    Check that the X509 version is correct
    (was incorrectly set in previous salt versions).
    This will fix the version if needed.
Severity: Minor
Found in salt/modules/tls.py - About 25 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 read_certificates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def read_certificates(glob_path):
    '''
    Returns a dict containing details of all certificates matching a glob

    glob_path:
Severity: Minor
Found in salt/modules/x509.py - About 25 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_none_or_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _get_none_or_value(value):
    '''
    PRIVATE METHOD
    Checks to see if the value of a primitive or built-in container such as
    a list, dict, set, tuple etc is empty or none. None type is returned if the
Severity: Minor
Found in salt/modules/solr.py - About 25 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_tab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def list_tab(user):
    '''
    Return the contents of the specified user's incrontab

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

def check(table='filter', chain=None, rule=None, family='ipv4'):
    '''
    Check for the existence of a rule in the table and chain

    This function accepts a rule in a standard nftables command format,
Severity: Minor
Found in salt/modules/nftables.py - About 25 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 serial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def serial(zone='', update=False):
    '''
    Return, store and update a dns serial for your zone files.

    zone: a keyword for a specific zone
Severity: Minor
Found in salt/modules/dnsutil.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

def __virtual__():
    '''
    Only load this module if the ca config options are set
    '''
    global X509_EXT_ENABLED
Severity: Minor
Found in salt/modules/tls.py - About 25 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_api_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_api_method(restApiId, resourcePath, httpMethod, authorizationType,
                      apiKeyRequired=False, requestParameters=None, requestModels=None,
                      region=None, key=None, keyid=None, profile=None):
    '''
    Creates API method for a resource in the given API
Severity: Minor
Found in salt/modules/boto_apigateway.py - About 25 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 _build_config_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _build_config_tree(name, configuration):
    '''
    Build the configuration tree.

    The root object is _current_statement.
Severity: Minor
Found in salt/modules/syslog_ng.py - About 25 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_pem_entries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_pem_entries(glob_path):
    '''
    Returns a dict containing PEM entries in files matching a glob

    glob_path:
Severity: Minor
Found in salt/modules/x509.py - About 25 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_signing_policy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_signing_policy(signing_policy_name):
    '''
    Returns the details of a names signing policy, including the text of
    the public key that will be used to sign it. Does not return the
    private key.
Severity: Minor
Found in salt/modules/x509.py - About 25 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_api_integration_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_api_integration_response(restApiId, resourcePath, httpMethod, statusCode, selectionPattern,
                                    responseParameters=None, responseTemplates=None,
                                    region=None, key=None, keyid=None, profile=None):
    '''
    Creates an integration response for a given method in a given API
Severity: Minor
Found in salt/modules/boto_apigateway.py - About 25 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