saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _verify has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def _verify(vm_):
    '''
    Verify credentials for an existing system
    '''
    log.info('Verifying credentials for %s', vm_['name'])
Severity: Minor
Found in salt/cloud/clouds/saltify.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 18 (exceeds 5 allowed). Consider refactoring.
Open

def init(opts):
    '''
    This function gets called when the proxy starts up. For
    login the protocol and port are cached.
    '''
Severity: Minor
Found in salt/proxy/esxvm.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 GET has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def GET(self, token=None, **kwargs):
        '''
        Return a websocket connection of Salt's event stream

        .. http:get:: /ws/(token)
Severity: Minor
Found in salt/netapi/rest_cherrypy/app.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 inject_default_call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def inject_default_call(self, high):
        '''
        Sets .call function to a state, if not there.

        :param high:
Severity: Minor
Found in salt/state.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 _recurse_config_to_dict has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def _recurse_config_to_dict(t_data):
    '''
    helper function to recurse through a vim object and attempt to return all child objects
    '''
    if not isinstance(t_data, type(None)):
Severity: Minor
Found in salt/pillar/vmware_pillar.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 _refresh_buckets_cache_file has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def _refresh_buckets_cache_file(creds, cache_file, multiple_env, environment, prefix):
    '''
    Retrieve the content of all buckets and cache the metadata to the buckets
    cache file
    '''
Severity: Minor
Found in salt/pillar/s3.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 _print_docs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _print_docs(self, ret):
        '''
        Print out the docstrings for all of the functions on the minions
        '''
        import salt.output
Severity: Minor
Found in salt/cli/salt.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 _sdc_mdata has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def _sdc_mdata(mdata_list=None, mdata_get=None):
    '''
    SDC Metadata specified by there specs
    https://eng.joyent.com/mdata/datadict.html
    '''
Severity: Minor
Found in salt/grains/mdata.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 default_gateway has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def default_gateway():
    '''
    Populates grains which describe whether a server has a default gateway
    configured or not. Uses `ip -4 route show` and `ip -6 route show` and greps
    for a `default` at the beginning of any line. Assuming the standard
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 display_output has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def display_output(data, out=None, opts=None, **kwargs):
    '''
    Print the passed data using the desired output
    '''
    if opts is None:
Severity: Minor
Found in salt/output/__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 beacon has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Read the log file and return match whole string

    .. code-block:: yaml
Severity: Minor
Found in salt/beacons/logs.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 authenticate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def authenticate(self, _=None):  # TODO: remove unused var
        '''
        Authenticate with the master, this method breaks the functional
        paradigm, it will update the master information from a fresh sign
        in, signing in can occur as often as needed to keep up with the
Severity: Minor
Found in salt/crypt.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 Deferred has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Deferred: function( func ) {
        var tuples = [
                // action, add listener, listener list, final state
                [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
Severity: Major
Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

    File telemetry.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Connection module for Telemetry
    
    .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/modules/telemetry.py - About 2 hrs to fix

      Function CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              "CHILD": function( type, what, argument, first, last ) {
                  var simple = type.slice( 0, 3 ) !== "nth",
                      forward = type.slice( -4 ) !== "last",
                      ofType = what === "of-type";
      
      
      Severity: Major
      Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

        File tomcat.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Manage Apache Tomcat web applications
        =====================================
        
        
        Severity: Minor
        Found in salt/states/tomcat.py - About 2 hrs to fix

          File vagrant.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          r'''
          Manage Vagrant VMs
          ==================
          
          
          Severity: Minor
          Found in salt/states/vagrant.py - About 2 hrs to fix

            File win_functions.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Various functions to be used by windows during start up and to monkey patch
            missing functions in other modules
            '''
            Severity: Minor
            Found in salt/utils/win_functions.py - About 2 hrs to fix

              File pbm.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Library for VMware Storage Policy management (via the pbm endpoint)
              
              This library is used to manage the various policies available in VMware
              Severity: Minor
              Found in salt/utils/pbm.py - About 2 hrs to fix

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

                def create(vm_):
                    '''
                    To create a single VM in the VMware environment.
                
                    Sample profile and arguments that can be specified in it can be found
                Severity: Major
                Found in salt/cloud/clouds/vmware.py - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language