saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def present(name, Bucket,
            LocationConstraint=None,
            ACL=None,
            CORSRules=None,
            LifecycleConfiguration=None,
Severity: Minor
Found in salt/states/boto_s3_bucket.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 get_interface_info_wmi has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

def get_interface_info_wmi():
    '''
    Uses WMI to gather Network Interface information. Should only run on
    Windows 7/2008 R2 and lower systems. This code was pulled from the
    ``win_interfaces`` function in ``salt.utils.network`` unchanged.
Severity: Minor
Found in salt/utils/win_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

Function compare_containers has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

def compare_containers(first, second, ignore=None):
    '''
    .. versionadded:: 2017.7.0
    .. versionchanged:: 2018.3.0
        Renamed from ``docker.compare_container`` to
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 resolve_dns has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

def resolve_dns(opts, fallback=True):
    '''
    Resolves the master_ip and master_uri options
    '''
    ret = {}
Severity: Minor
Found in salt/minion.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 sysmod.py has 633 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The sys module provides information about the available functions on the minion
'''
from __future__ import absolute_import, unicode_literals, print_function
Severity: Major
Found in salt/modules/sysmod.py - About 1 day to fix

    File boto_iot.py has 631 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Manage IoT Objects
    ==================
    
    
    Severity: Major
    Found in salt/states/boto_iot.py - About 1 day to fix

      File cron.py has 631 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Management of cron, the Unix command scheduler
      ==============================================
      
      
      Severity: Major
      Found in salt/states/cron.py - About 1 day to fix

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

        def present(name,
                    host='localhost',
                    password=None,
                    password_hash=None,
                    allow_passwordless=False,
        Severity: Minor
        Found in salt/states/mysql_user.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 kill_children has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
        Open

            def kill_children(self, *args, **kwargs):
                '''
                Kill all of the children
                '''
                # first lets reset signal handlers to default one to prevent running this twice
        Severity: Minor
        Found in salt/utils/process.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 getfacl has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
        Open

        def getfacl(*args, **kwargs):
            '''
            Return (extremely verbose) map of FACLs on specified file(s)
        
            CLI Examples:
        Severity: Minor
        Found in salt/modules/linux_acl.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 get_vm_config has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_vm_config(name, datacenter=None, objects=True, service_instance=None):
            '''
            Queries and converts the virtual machine properties to the available format
            from the schema. If the objects attribute is True the config objects will
            have extra properties, like 'object' which will include the
        Severity: Minor
        Found in salt/modules/vsphere.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 boto_iot.py has 628 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Connection module for Amazon IoT
        
        .. versionadded:: 2016.3.0
        Severity: Major
        Found in salt/modules/boto_iot.py - About 1 day to fix

          Function run has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
          Open

              def run(self):
                  if getattr(self.distribution, 'salt_download_windows_dlls', None) is None:
                      print('This command is not meant to be called on it\'s own')
                      exit(1)
                  import pip
          Severity: Minor
          Found in setup.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 69 (exceeds 5 allowed). Consider refactoring.
          Open

          def append(name, table='filter', family='ipv4', **kwargs):
              '''
              .. versionadded:: 0.17.0
          
              Add a rule to the end of the specified chain.
          Severity: Minor
          Found in salt/states/iptables.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 dvs.py has 620 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Manage VMware distributed virtual switches (DVSs) and their distributed virtual
          portgroups (DVportgroups).
          
          
          Severity: Major
          Found in salt/states/dvs.py - About 1 day to fix

            File process.py has 619 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Functions for daemonizing and otherwise modifying running processes
            '''
            
            
            Severity: Major
            Found in salt/utils/process.py - About 1 day to fix

              File find.py has 618 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Approximate the Unix find(1) command and return a list of paths that
              meet the specified criteria.
              
              
              Severity: Major
              Found in salt/utils/find.py - About 1 day to fix

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

                def present(name, value=None, contains=None, excludes=None):
                    '''
                    Verify that the variable is in the ``make.conf`` and has the provided
                    settings. If value is set, contains and excludes will be ignored.
                
                
                Severity: Minor
                Found in salt/states/makeconf.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 68 (exceeds 5 allowed). Consider refactoring.
                Open

                def _run(name, **kwargs):
                    '''
                    .. deprecated:: 2017.7.0
                       Function name stays the same, behaviour will change.
                
                
                Severity: Minor
                Found in salt/states/module.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 _file_lists has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
                Open

                def _file_lists(load, form):
                    '''
                    Return a dict containing the file lists for files, dirs, emtydirs and symlinks
                    '''
                    if 'env' in load:
                Severity: Minor
                Found in salt/fileserver/roots.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