saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function gather_cache has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

    def gather_cache(self):
        '''
        Gather the specified data from the minion data cache
        '''
        cache = {'grains': {}, 'pillar': {}}
Severity: Minor
Found in salt/thorium/__init__.py - About 1 day 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 _gen_keep_files has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

def _gen_keep_files(name, require, walk_d=None):
    '''
    Generate the list of files that need to be kept when a dir based function
    like directory or recurse has a clean.
    '''
Severity: Minor
Found in salt/states/file.py - About 1 day 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 58 (exceeds 5 allowed). Consider refactoring.
Open

def run(name,
        cmd,
        container_type=None,
        exec_driver=None,
        output=None,
Severity: Minor
Found in salt/modules/container_resource.py - About 1 day 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 set_special has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

def set_special(user,
                special,
                cmd,
                commented=False,
                comment=None,
Severity: Minor
Found in salt/modules/cron.py - About 1 day 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 request_instance has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

def request_instance(vm_=None, call=None):
    '''
    Put together all of the information necessary to request an instance
    through Novaclient and then fire off the request the instance.

Severity: Minor
Found in salt/cloud/clouds/nova.py - About 1 day 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 genrepo has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

def genrepo(opts=None, fire_event=True):
    '''
    Generate winrepo_cachefile based on sls files in the winrepo_dir

    opts
Severity: Minor
Found in salt/runners/winrepo.py - About 1 day 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_opts has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

def _validate_opts(opts):
    '''
    Check that all of the types of values passed into the config are
    of the right types
    '''
Severity: Minor
Found in salt/config/__init__.py - About 1 day 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 57 (exceeds 5 allowed). Consider refactoring.
Open

def present(name,
            users=None,
            theme=None,
            home_dashboard_id=None,
            timezone=None,
Severity: Minor
Found in salt/states/grafana4_org.py - About 1 day 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 append has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def append(name,
           text=None,
           makedirs=False,
           source=None,
           source_hash=None,
Severity: Minor
Found in salt/states/file.py - About 1 day 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_file has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def run_file(name,
        database,
        query_file=None,
        output=None,
        grain=None,
Severity: Minor
Found in salt/states/mysql_query.py - About 1 day 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 subnet_present has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def subnet_present(name, cidr_block, vpc_name=None, vpc_id=None,
                   availability_zone=None, tags=None,
                   region=None, key=None,
                   keyid=None, profile=None,
                   route_table_id=None, route_table_name=None, auto_assign_public_ipv4=False):
Severity: Minor
Found in salt/states/boto_vpc.py - About 1 day 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_container has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def run_container(image,
                  name=None,
                  skip_translate=None,
                  ignore_collisions=False,
                  validate_ip_addrs=True,
Severity: Minor
Found in salt/modules/dockermod.py - About 1 day 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 device has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def device(dev, stats=False, config=False, internals=False, superblock=False):
    '''
    Check the state of a single bcache device

    CLI example:
Severity: Minor
Found in salt/modules/bcache.py - About 1 day 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 has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    def read(self):
        '''
        Read in the specified map and return the map structure
        '''
        map_ = None
Severity: Minor
Found in salt/cloud/__init__.py - About 1 day 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_node_data has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def _query_node_data(vm_, data, conn):
    try:
        node = show_instance(vm_['name'], 'action')
        log.debug('Loaded node data for %s:\n%s', vm_['name'], pprint.pformat(node))
    except Exception as err:
Severity: Minor
Found in salt/cloud/clouds/nova.py - About 1 day 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 softlayer.py has 538 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
SoftLayer Cloud Module
======================

Severity: Major
Found in salt/cloud/clouds/softlayer.py - About 1 day to fix

    File module.py has 537 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    r'''
    Execution of Salt modules from within states
    ============================================
    
    
    Severity: Major
    Found in salt/states/module.py - About 1 day to fix

      File ps.py has 536 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      A salt interface to psutil, a system and process library.
      See http://code.google.com/p/psutil.
      
      
      Severity: Major
      Found in salt/modules/ps.py - About 1 day to fix

        SaltNova has 61 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SaltNova(object):
            '''
            Class for all novaclient functions
            '''
            extensions = []
        Severity: Major
        Found in salt/utils/openstack/nova.py - About 1 day to fix

          Function network_interface_present has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

          def network_interface_present(name, ip_configurations, subnet, virtual_network, resource_group, tags=None,
                                        virtual_machine=None, network_security_group=None, dns_settings=None, mac_address=None,
                                        primary=None, enable_accelerated_networking=None, enable_ip_forwarding=None,
                                        connection_auth=None, **kwargs):
              '''
          Severity: Minor
          Found in salt/states/azurearm_network.py - About 1 day 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