saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def clean_pub_auth(opts):
    try:
        auth_cache = os.path.join(opts['cachedir'], 'publish_auth')
        if not os.path.exists(auth_cache):
            return
Severity: Minor
Found in salt/daemons/masterapi.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_state_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_state_file(state_file_path='terraform.tfstate'):
    '''
    Parses the terraform state file passing different resource types to the right handler
    '''
    ret = {}
Severity: Minor
Found in salt/roster/terraform.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 _traverse_repos has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _traverse_repos(self, callback, repo_name=None):
        '''
        Traverse through all repo files and apply the functionality provided in
        the callback to them
        '''
Severity: Minor
Found in salt/spm/__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 topic_rule_present has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def topic_rule_present(name, ruleName, sql, actions, description='',
            ruleDisabled=False,
            region=None, key=None, keyid=None, profile=None):
    '''
    Ensure topic rule exists.
Severity: Minor
Found in salt/states/boto_iot.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 volume_absent has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def volume_absent(name, volume_name=None, volume_id=None, instance_name=None,
                  instance_id=None, device=None, region=None, key=None, keyid=None, profile=None):
    '''
    Ensure the EC2 volume is detached and absent.

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

def route_present(name, address_prefix, next_hop_type, route_table, resource_group, next_hop_ip_address=None,
                  connection_auth=None, **kwargs):
    '''
    .. versionadded:: 2019.2.0

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

def coalesce(name, **kwargs):
    '''
    Manage coalescing settings of network device

    name
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 decode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def decode(name,
        encoded_data=None,
        contents_pillar=None,
        encoding_type='base64',
        checksum='md5'):
Severity: Minor
Found in salt/states/file.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 snapshot_present has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def snapshot_present(name, recursive=False, properties=None):
    '''
    ensure snapshot exists and has properties set

    name : string
Severity: Minor
Found in salt/states/zfs.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 _diff_cache_subnet_group has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _diff_cache_subnet_group(current, desired):
    '''
    If you need to enhance what modify_cache_subnet_group() considers when deciding what is to be
    (or can be) updated, add it to 'modifiable' below.  It's a dict mapping the param as used
    in modify_cache_subnet_group() to that in describe_cache_subnet_group().  Any data fiddlery that
Severity: Minor
Found in salt/states/boto3_elasticache.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 _cleaned has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _cleaned(_dashboard):
    '''Return a copy without fields that can differ.'''
    dashboard = copy.deepcopy(_dashboard)

    for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS:
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 uptodate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def uptodate(name,
             software=True,
             drivers=False,
             skip_hidden=False,
             skip_mandatory=False,
Severity: Minor
Found in salt/states/win_wua.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 _cleaned has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _cleaned(_dashboard):
    '''Return a copy without fields that can differ.'''
    dashboard = copy.deepcopy(_dashboard)

    for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS:
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 managed has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def managed(name, table, data, record=None):
    '''
    Ensures that the specified columns of the named record have the specified
    values.

Severity: Minor
Found in salt/states/openvswitch_db.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 16 (exceeds 5 allowed). Consider refactoring.
Open

def present(name=None, data=None, ensure_data=True, **api_opts):
    '''
    Ensure the CNAME with the given data is present.

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

def manage_pool_members(hostname, username, password, name, members):
    '''
    Manage the members of an existing pool.  This function replaces all current pool members.
    Only the parameters specified are enforced.

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 _validate_response has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _validate_response(response):
    '''
    Validates a response from a Palo Alto device. Used to verify success of commands.

    '''
Severity: Minor
Found in salt/states/panos.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 16 (exceeds 5 allowed). Consider refactoring.
Open

def present(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
    '''
    Ensure range record is present.

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

def _split_rules(rules):
    '''
    Split rules with lists into individual rules.

    We accept some attributes as lists or strings. The data we get back from
Severity: Minor
Found in salt/states/boto_secgroup.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 acl_present has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def acl_present(name, id=None, token=None, type="client", rules="", consul_url='http://localhost:8500'):
    '''
    Ensure the ACL is present

    name
Severity: Minor
Found in salt/states/consul.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