saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

File panos.py has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Proxy Minion interface module for managing Palo Alto firewall devices
=====================================================================

Severity: Minor
Found in salt/proxy/panos.py - About 4 hrs to fix

    File salt.py has 359 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    
    # Import python libs
    from __future__ import absolute_import, print_function, unicode_literals
    import sys
    Severity: Minor
    Found in salt/cli/salt.py - About 4 hrs to fix

      File ssdp.py has 358 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      #
      # Author: Bo Maryniuk <bo@suse.de>
      #
      # Copyright 2017 SUSE LLC
      Severity: Minor
      Found in salt/utils/ssdp.py - About 4 hrs to fix

        Function _prep_pub has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def _prep_pub(self, minions, jid, clear_load, extra, missing):
                '''
                Take a given load and perform the necessary steps
                to prepare a publication.
        
        
        Severity: Minor
        Found in salt/master.py - About 4 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 returner has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def returner(ret):
            '''
            Process the return from Salt
            '''
        
        
        Severity: Minor
        Found in salt/returners/elasticsearch_return.py - About 4 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 config has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def config(name, config):
            '''
            Ensure that the chronos job with the given name is present and is configured
            to match the given config values.
        
        
        Severity: Minor
        Found in salt/states/chronos_job.py - About 4 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 cluster_node_present has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def cluster_node_present(name, node, extra_args=None):
            '''
            Add a node to the Pacemaker cluster via PCS
            Should be run on one cluster node only
            (there may be races)
        Severity: Minor
        Found in salt/states/pcs.py - About 4 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 availability_set_present has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def availability_set_present(name, resource_group, tags=None, platform_update_domain_count=None,
                                     platform_fault_domain_count=None, virtual_machines=None, sku=None, connection_auth=None,
                                     **kwargs):
            '''
            .. versionadded:: 2019.2.0
        Severity: Minor
        Found in salt/states/azurearm_compute.py - About 4 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 _layout_to_vdev has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def _layout_to_vdev(layout, device_dir=None):
            '''
            Turn the layout data into usable vdevs spedcification
        
            We need to support 2 ways of passing the layout:
        Severity: Minor
        Found in salt/states/zpool.py - About 4 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 has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def _validate(dns_proto, dns_servers, ip_proto, ip_addrs, gateway):
            '''
            Ensure that the configuration passed is formatted correctly and contains
            valid IP addresses, etc.
            '''
        Severity: Minor
        Found in salt/states/win_network.py - About 4 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 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def present(name,
                    save=False,
                    **kwargs):
            '''
            Ensure beacon is configured with the included beacon data.
        Severity: Minor
        Found in salt/states/beacon.py - About 4 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 _listeners_present has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def _listeners_present(name, listeners, region, key, keyid, profile):
            ret = {'result': True, 'comment': '', 'changes': {}}
            lb = __salt__['boto_elb.get_elb_config'](name, region, key, keyid, profile)
            if not lb:
                ret['comment'] = '{0} ELB configuration could not be retrieved.'.format(name)
        Severity: Minor
        Found in salt/states/boto_elb.py - About 4 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 reverted has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def reverted(name, snapshot=None, cleanup=False):  # pylint: disable=redefined-outer-name
            '''
            .. deprecated:: 2016.3.0
        
            Reverts to the particular snapshot.
        Severity: Minor
        Found in salt/states/virt.py - About 4 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 _alarms_present has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def _alarms_present(name, min_size_equals_max_size, alarms, alarms_from_pillar, region, key, keyid, profile):
            '''
            helper method for present.  ensure that cloudwatch_alarms are set
            '''
            # load data from alarms_from_pillar
        Severity: Minor
        Found in salt/states/boto_asg.py - About 4 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 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def present(name=None,
                    table_name=None,
                    region=None,
                    key=None,
                    keyid=None,
        Severity: Minor
        Found in salt/states/boto_dynamodb.py - About 4 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 _generate_minion_id has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def _generate_minion_id():
            '''
            Get list of possible host names and convention names.
        
            :return:
        Severity: Minor
        Found in salt/utils/network.py - About 4 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_vault_connection has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_vault_connection():
            '''
            Get the connection details for calling Vault, from local configuration if
            it exists, or from the master otherwise
            '''
        Severity: Minor
        Found in salt/utils/vault.py - About 4 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 pg_remove has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def pg_remove(name, hostgroup=None, host=None, volume=None):
            '''
        
            Remove a hostgroup, host or volume from a protection group on a Pure Storage FlashArray.
        
        
        Severity: Minor
        Found in salt/modules/purefa.py - About 4 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 parseData has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def parseData(self, data, host, port, options):
                '''
                This function will parse the raw syslog data, dynamically create the
                topic according to the topic specified by the user (if specified) and
                decide whether to send the syslog data as an event on the master bus,
        Severity: Minor
        Found in salt/engines/junos_syslog.py - About 4 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 del_repo has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def del_repo(repo, **kwargs):  # pylint: disable=unused-argument
            '''
            Delete a repo from ``/etc/opkg/*.conf``
        
            If the file does not contain any other repo configuration, the file itself
        Severity: Minor
        Found in salt/modules/opkg.py - About 4 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