saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

File vultrpy.py has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Vultr Cloud Module using python-vultr bindings
==============================================

Severity: Minor
Found in salt/cloud/clouds/vultrpy.py - About 5 hrs to fix

    Function present has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def present(name, ip, clean=False):  # pylint: disable=C0103
        '''
        Ensures that the named host is present with the given ip
    
        name
    Severity: Minor
    Found in salt/states/host.py - About 5 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 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def present(name, value, zone, record_type, ttl=None, identifier=None, region=None, key=None,
                keyid=None, profile=None, wait_for_sync=True, split_dns=False, private_zone=False):
        '''
        Ensure the Route53 record is present.
    
    
    Severity: Minor
    Found in salt/states/boto_route53.py - About 5 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 rotate has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def rotate(name, **kwargs):
        '''
        Add a log to the logadm configuration
    
        name : string
    Severity: Minor
    Found in salt/states/logadm.py - About 5 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 __fetch_from_artifactory has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def __fetch_from_artifactory(artifact, target_dir, target_file, use_literal_group_id):
        if ('latest_snapshot' in artifact and artifact['latest_snapshot']) or artifact['version'] == 'latest_snapshot':
            fetch_result = __salt__['artifactory.get_latest_snapshot'](artifactory_url=artifact['artifactory_url'],
                                                                       repository=artifact['repository'],
                                                                       group_id=artifact['group_id'],
    Severity: Minor
    Found in salt/states/artifactory.py - About 5 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_dict has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def decode_dict(data, encoding=None, errors='strict', keep=False,
                    normalize=False, preserve_dict_class=False,
                    preserve_tuples=False, to_str=False):
        '''
        Decode all string values to Unicode. Optionally use to_str=True to ensure
    Severity: Minor
    Found in salt/utils/data.py - About 5 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 win_verify_env has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def win_verify_env(
            path,
            dirs,
            permissive=False,
            pki_dir='',
    Severity: Minor
    Found in salt/utils/verify.py - About 5 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 run has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self):
            '''
            Main loop of the ConCache, starts updates in intervals and
            answers requests from the MWorkers
            '''
    Severity: Minor
    Found in salt/utils/master.py - About 5 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_for_task has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def wait_for_task(task, instance_name, task_type, sleep_seconds=1, log_level='debug'):
        '''
        Waits for a task to be completed.
    
        task
    Severity: Minor
    Found in salt/utils/vmware.py - About 5 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 lookup has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def lookup(
        name,
        rdtype,
        method=None,
        servers=None,
    Severity: Minor
    Found in salt/utils/dns.py - About 5 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 _run_runner has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def _run_runner(self):
            '''
            Actually execute specific runner
            :return:
            '''
    Severity: Minor
    Found in salt/runner.py - About 5 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 verify_auth has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_auth(self):
            '''
            Check the username and password/keypair info for validity. If valid,
            set a 'credentials' attribute consisting of the appropriate Pygit2
            credentials object. Return False if a required auth param is not
    Severity: Minor
    Found in salt/utils/gitfs.py - About 5 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 execute has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def execute(context=None, lens=None, commands=(), load_path=None):
        '''
        Execute Augeas commands
    
        .. versionadded:: 2014.7.0
    Severity: Minor
    Found in salt/modules/augeas_cfg.py - About 5 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 host_exists has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def host_exists(host=None, hostid=None, name=None, node=None, nodeids=None, **kwargs):
        '''
        Checks if at least one host that matches the given filter criteria exists.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/modules/zabbix.py - About 5 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 _resource has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def _resource(methode, zone, resource_type, resource_selector, **kwargs):
        '''
        internal resource hanlder
    
        methode : string
    Severity: Minor
    Found in salt/modules/zonecfg.py - About 5 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_zone has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_zone(zonefile=None, zone=None):
        '''
        Parses a zone file. Can be passed raw zone data on the API level.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/dnsutil.py - About 5 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 clonevm has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def clonevm(name=None,
                uuid=None,
                new_name=None,
                snapshot_uuid=None,
                snapshot_name=None,
    Severity: Minor
    Found in salt/modules/vboxmanage.py - About 5 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 latest_version has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def latest_version(*names, **kwargs):
        '''
        .. versionchanged: 2016.3.0
    
        Return the latest version of the named package available for upgrade or
    Severity: Minor
    Found in salt/modules/pkgin.py - About 5 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 update has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def update(name, launch_config_name, availability_zones, min_size, max_size,
               desired_capacity=None, load_balancers=None, default_cooldown=None,
               health_check_type=None, health_check_period=None,
               placement_group=None, vpc_zone_identifier=None, tags=None,
               termination_policies=None, suspended_processes=None,
    Severity: Minor
    Found in salt/modules/boto_asg.py - About 5 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 update_git_repos has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_git_repos(opts=None, clean=False, masterless=False):
        '''
        Checkout git repos containing Windows Software Package Definitions
    
        opts
    Severity: Minor
    Found in salt/runners/winrepo.py - About 5 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