saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function display has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def display(self, ret, indent, prefix, out):
        '''
        Recursively iterate down through data structures to determine output
        '''
        if isinstance(ret, bytes):
Severity: Minor
Found in salt/output/nested.py - About 6 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 beacon has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Scan for the configured services and fire events

    Example Config
Severity: Minor
Found in salt/beacons/service.py - About 6 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

File pgjsonb.py has 447 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Return data to a PostgreSQL server with json data stored in Pg's jsonb data type

:maintainer:    Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com>
Severity: Minor
Found in salt/returners/pgjsonb.py - About 6 hrs to fix

    File cloudstack.py has 447 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    CloudStack Cloud Module
    =======================
    
    
    Severity: Minor
    Found in salt/cloud/clouds/cloudstack.py - About 6 hrs to fix

      File stack.py has 447 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Simple and flexible YAML ext_pillar which can read pillar from within pillar.
      
      .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/pillar/stack.py - About 6 hrs to fix

        File rbac_solaris.py has 446 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Module for Solaris' Role-Based Access Control
        '''
        from __future__ import absolute_import, unicode_literals, print_function
        Severity: Minor
        Found in salt/modules/rbac_solaris.py - About 6 hrs to fix

          File saltutil.py has 445 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          The Saltutil runner is used to sync custom types to the Master. See the
          :mod:`saltutil module <salt.modules.saltutil>` for documentation on
          managing updates to minions.
          Severity: Minor
          Found in salt/runners/saltutil.py - About 6 hrs to fix

            File timezone.py has 444 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Module for managing timezone on POSIX-like systems.
            '''
            
            
            Severity: Minor
            Found in salt/modules/timezone.py - About 6 hrs to fix

              File ldap3.py has 443 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Query and modify an LDAP database (alternative interface)
              =========================================================
              
              
              Severity: Minor
              Found in salt/modules/ldap3.py - About 6 hrs to fix

                File mac_system.py has 443 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                System module for sleeping, restarting, and shutting down the system on Mac OS X
                
                .. versionadded:: 2016.3.0
                Severity: Minor
                Found in salt/modules/mac_system.py - About 6 hrs to fix

                  File artifactory.py has 441 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Module for fetching artifacts from Artifactory
                  '''
                  
                  
                  Severity: Minor
                  Found in salt/modules/artifactory.py - About 6 hrs to fix

                    Function resource_absent has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def resource_absent(name, resource_type, resource_selector_property, resource_selector_value):
                        '''
                        Ensure resource is absent
                    
                        name : string
                    Severity: Minor
                    Found in salt/states/zone.py - About 6 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 licenses_configured has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def licenses_configured(name, licenses=None):
                        '''
                        Configures licenses on the cluster entity
                    
                        Checks if each license exists on the server:
                    Severity: Minor
                    Found in salt/states/esxcluster.py - About 6 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 setup_logfile_logger has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def setup_logfile_logger(log_path, log_level='error', log_format=None,
                                             date_format=None, max_bytes=0, backup_count=0):
                        '''
                        Setup the logfile logger
                    
                    
                    Severity: Minor
                    Found in salt/log/setup.py - About 6 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 bootstrap has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def bootstrap(vm_, opts=None):
                        '''
                        This is the primary entry point for logging into any system (POSIX or
                        Windows) to install Salt. It will make the decision on its own as to which
                        deploy function to call.
                    Severity: Minor
                    Found in salt/utils/cloud.py - About 6 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 dns_check has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def dns_check(addr, port=80, safe=False, ipv6=None, attempt_connect=True):
                        '''
                        Return the ip resolved by dns, but do not exit on failure, only raise an
                        exception. Obeys system preference for IPv4/6 address resolution - this
                        can be overridden by the ipv6 flag.
                    Severity: Minor
                    Found in salt/utils/network.py - About 6 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_cookie_header has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def parse_cookie_header(header):
                        '''
                        Parse the "Set-cookie" header, and return a list of cookies.
                    
                        This function is here because Tornado's HTTPClient doesn't handle cookies.
                    Severity: Minor
                    Found in salt/utils/http.py - About 6 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 bootstrap has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def bootstrap(directory='.',
                                  config='buildout.cfg',
                                  python=sys.executable,
                                  onlyif=None,
                                  unless=None,
                    Severity: Minor
                    Found in salt/modules/zcbuildout.py - About 6 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 set_lcm_config has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def set_lcm_config(config_mode=None,
                                       config_mode_freq=None,
                                       refresh_freq=None,
                                       reboot_if_needed=None,
                                       action_after_reboot=None,
                    Severity: Minor
                    Found in salt/modules/win_dsc.py - About 6 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

                    File nexus.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    Module for fetching artifacts from Nexus 3.x
                    
                    .. versionadded:: 2018.3.0
                    Severity: Minor
                    Found in salt/modules/nexus.py - About 6 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language