saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def create(vm_):
    '''
    Create a single VM from a data dict
    '''
    try:
Severity: Major
Found in salt/cloud/clouds/softlayer.py - About 2 hrs to fix

    File win_powercfg.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    This module allows you to control the power settings of a windows minion via
    powercfg.
    
    
    Severity: Minor
    Found in salt/modules/win_powercfg.py - About 2 hrs to fix

      File pkgutil.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Pkgutil support for Solaris
      
      .. important::
      Severity: Minor
      Found in salt/modules/pkgutil.py - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                                if ( forward && useCache ) {
                                    // Seek `elem` from a previously-cached index
                                    outerCache = parent[ expando ] || (parent[ expando ] = {});
                                    cache = outerCache[ type ] || [];
                                    nodeIndex = cache[0] === dirruns && cache[1];
        Severity: Critical
        Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

              if tests or missing:
                  ret['comment'] = ' '.join([
                      missing and "Unavailable function{plr}: "
                                  "{func}.".format(plr=(len(missing) > 1 or ''),
                                                   func=(', '.join(missing) or '')) or '',
          Severity: Critical
          Found in salt/states/module.py - About 2 hrs to fix

            OrderedDict has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

                    class OrderedDict(dict):
                        'Dictionary that remembers insertion order'
                        # An inherited dict maps keys to values.
                        # The inherited dict provides __getitem__, __len__, __contains__, and get.
                        # The remaining methods are order-aware.
            Severity: Minor
            Found in salt/utils/odict.py - About 2 hrs to fix

              Inspector has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Inspector(EnvLoader):
                  DEFAULT_MINION_CONFIG_PATH = '/etc/salt/minion'
              
                  MODE = ['configuration', 'payload', 'all']
                  IGNORE_MOUNTS = ["proc", "sysfs", "devtmpfs", "tmpfs", "fuse.gvfs-fuse-daemon"]
              Severity: Minor
              Found in salt/modules/inspectlib/collector.py - About 2 hrs to fix

                AsyncAuth has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class AsyncAuth(object):
                    '''
                    Set up an Async object to maintain authentication with the salt master
                    '''
                    # This class is only a singleton per minion/master pair
                Severity: Minor
                Found in salt/crypt.py - About 2 hrs to fix

                  Function init has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      init: function( selector, context, rootjQuery ) {
                          var match, elem;
                  
                          // HANDLE: $(""), $(null), $(undefined), $(false)
                          if ( !selector ) {
                  Severity: Major
                  Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

                    File etcd_mod.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    
                    '''
                    Manage etcd Keys
                    ================
                    Severity: Minor
                    Found in salt/states/etcd_mod.py - About 2 hrs to fix

                      File launchctl_service.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # -*- coding: utf-8 -*-
                      '''
                      Module for the management of MacOS systems that use launchd/launchctl
                      
                      .. important::
                      Severity: Minor
                      Found in salt/modules/launchctl_service.py - About 2 hrs to fix

                        File pkg_resource.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # -*- coding: utf-8 -*-
                        '''
                        Resources needed by pkg providers
                        '''
                        
                        
                        Severity: Minor
                        Found in salt/modules/pkg_resource.py - About 2 hrs to fix

                          Function request_instance has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          def request_instance(vm_):
                              '''
                              Request a VM from Azure.
                              '''
                              compconn = get_conn(client_type='compute')
                          Severity: Major
                          Found in salt/cloud/clouds/azurearm.py - About 2 hrs to fix

                            File fsdb.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            # -*- coding: utf-8 -*-
                            #
                            # Copyright 2016 SUSE LLC
                            #
                            # Licensed under the Apache License, Version 2.0 (the "License");
                            Severity: Minor
                            Found in salt/modules/inspectlib/fsdb.py - About 2 hrs to fix

                              File namecheap_domains.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              # -*- coding: utf-8 -*-
                              '''
                              Namecheap Domain Management
                              
                              .. versionadded:: 2017.7.0
                              Severity: Minor
                              Found in salt/modules/namecheap_domains.py - About 2 hrs to fix

                                Function _get_conn has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def _get_conn(ret):
                                    '''
                                    Return a mongodb connection object
                                    '''
                                    _options = _get_options(ret)
                                Severity: Minor
                                Found in salt/returners/mongo_future_return.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 __discover_version has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def __discover_version(saltstack_version):
                                    # This might be a 'python setup.py develop' installation type. Let's
                                    # discover the version information at runtime.
                                    import os
                                    import subprocess
                                Severity: Minor
                                Found in salt/version.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 uninstalled has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def uninstalled(name):
                                    '''
                                    Ensure zone is uninstalled
                                
                                    name : string
                                Severity: Minor
                                Found in salt/states/zone.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 downloaded has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def downloaded(name,
                                               version=None,
                                               pkgs=None,
                                               fromrepo=None,
                                               ignore_epoch=None,
                                Severity: Minor
                                Found in salt/states/pkg.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 attached has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def attached(name, force=False):
                                    '''
                                    Ensure zone is attached
                                
                                    name : string
                                Severity: Minor
                                Found in salt/states/zone.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

                                Severity
                                Category
                                Status
                                Source
                                Language