saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _flush_content has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _flush_content(self):
        '''
        Flush content to the archive
        :return:
        '''
Severity: Minor
Found in salt/cli/support/collector.py - About 2 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 prepare has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def prepare(self):
        '''
        Run the preparation sequence required to start a salt minion.

        If sub-classed, don't **ever** forget to run:
Severity: Minor
Found in salt/cli/daemons.py - About 2 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 _linux_cpudata has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _linux_cpudata():
    '''
    Return some CPU information for Linux minions
    '''
    # Provides:
Severity: Minor
Found in salt/grains/core.py - About 2 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 apply_sdb has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def apply_sdb(opts, sdb_opts=None):
    '''
    Recurse for sdb:// links for opts
    '''
    # Late load of SDB to keep CLI light
Severity: Minor
Found in salt/config/__init__.py - About 2 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 __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None):  # pylint: disable=W0231
        '''
        Pass in the options dict
        '''
        # this means that the parent class doesn't know *which* master we connect to
Severity: Minor
Found in salt/minion.py - About 2 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 _connect_minion has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _connect_minion(self, minion):
        '''
        Create a minion, and asynchronously connect it to a master
        '''
        auth_wait = minion.opts['acceptance_wait_time']
Severity: Minor
Found in salt/minion.py - About 2 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 _find_files has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _find_files(metadata):
    '''
    Looks for all the files in the S3 bucket cache metadata
    '''

Severity: Minor
Found in salt/fileserver/s3fs.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

def update():
    '''
    Execute an hg pull on all of the repos
    '''
    # data for the fileserver event
Severity: Minor
Found in salt/fileserver/hgfs.py - About 2 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 pydsl.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
A Python-based DSL

:maintainer: Jack Kuan <kjkuan@gmail.com>
Severity: Minor
Found in salt/renderers/pydsl.py - About 2 hrs to fix

    File postgres_default_privileges.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Management of PostgreSQL Default Privileges
    ===========================================
    
    
    Severity: Minor
    Found in salt/states/postgres_default_privileges.py - About 2 hrs to fix

      File djangomod.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Manage Django sites
      '''
      
      
      Severity: Minor
      Found in salt/modules/djangomod.py - About 2 hrs to fix

        File pf.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Control the OpenBSD packet filter (PF).
        
        :codeauthor: Jasper Lievisse Adriaanse <j@jasper.la>
        Severity: Minor
        Found in salt/modules/pf.py - About 2 hrs to fix

          Function ajaxConvert has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function ajaxConvert( s, response ) {
              var conv2, current, conv, tmp,
                  converters = {},
                  i = 0,
                  // Work with a copy of dataTypes in case we need to modify it for conversion
          Severity: Major
          Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

            Function internalData has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function internalData( elem, name, data, pvt /* Internal Use Only */ ){
                if ( !jQuery.acceptData( elem ) ) {
                    return;
                }
            
            
            Severity: Major
            Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

              Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  remove: function( elem, types, handler, selector, mappedTypes ) {
                      var j, handleObj, tmp,
                          origCount, t, events,
                          special, handlers, type,
                          namespaces, origType,
              Severity: Major
              Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

                File boto_cloudwatch.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Connection module for Amazon CloudWatch
                
                .. versionadded:: 2014.7.0
                Severity: Minor
                Found in salt/modules/boto_cloudwatch.py - About 2 hrs to fix

                  File cryptdev.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Salt module to manage Unix cryptsetup jobs and the crypttab file
                  
                  .. versionadded:: 2018.3.0
                  Severity: Minor
                  Found in salt/modules/cryptdev.py - About 2 hrs to fix

                    File mac_timezone.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    Module for editing date/time settings on macOS
                    
                     .. versionadded:: 2016.3.0
                    Severity: Minor
                    Found in salt/modules/mac_timezone.py - About 2 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                                      if ( ( mappedTypes || origType === handleObj.origType ) &&
                                          ( !handler || handler.guid === handleObj.guid ) &&
                                          ( !tmp || tmp.test( handleObj.namespace ) ) &&
                                          ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
                                          handlers.splice( j, 1 );
                      Severity: Critical
                      Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

                        Function create has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        def create(vm_=None, call=None):
                            '''
                            Create a single VM from a data dict
                            '''
                            if call:
                        Severity: Minor
                        Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language