saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function is_file_ignored has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def is_file_ignored(opts, fname):
    '''
    If file_ignore_regex or file_ignore_glob were given in config,
    compare the given file path against all of them and return True
    on the first match.
Severity: Minor
Found in salt/fileserver/__init__.py - About 1 hr 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 clone has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    clone: function( elem, dataAndEvents, deepDataAndEvents ) {
        var destElements, node, clone, i, srcElements,
            inPage = jQuery.contains( elem.ownerDocument, elem );

        if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
Severity: Minor
Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

    Function dispatch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        dispatch: function( event ) {
    
            // Make a writable jQuery.Event from the native event object
            event = jQuery.event.fix( event );
    
    
    Severity: Minor
    Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

      Function access has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
              var i = 0,
                  length = elems.length,
                  bulk = key == null;
      
      
      Severity: Minor
      Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

        Function cleanData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            cleanData: function( elems, /* internal */ acceptData ) {
                var elem, type, id, data,
                    i = 0,
                    internalKey = jQuery.expando,
                    cache = jQuery.cache,
        Severity: Minor
        Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

          Function webforms has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function webforms() {
                                                      Modernizr['input'] = (function( props ) {
                      for ( var i = 0, len = props.length; i < len; i++ ) {
                          attrs[ props[i] ] = !!(props[i] in inputElem);
                      }

            Function style has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                style: function( elem, name, value, extra ) {
                    // Don't set styles on text and comment nodes
                    if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
                        return;
                    }
            Severity: Minor
            Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

              Function data has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  data: function( key, value ) {
                      var attrs, name,
                          elem = this[0],
                          i = 0,
                          data = null;
              Severity: Minor
              Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

                Function returner has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def returner(ret):
                    '''
                    Send an email with the data
                    '''
                
                
                Severity: Minor
                Found in salt/returners/smtp_return.py - About 1 hr to fix

                  Function state has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def state(name,
                          tgt,
                          ssh=False,
                          tgt_type='glob',
                          ret='',
                  Severity: Minor
                  Found in salt/states/saltmod.py - About 1 hr to fix

                    Function chassis has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def chassis(name, chassis_name=None, password=None, datacenter=None,
                                location=None, mode=None, idrac_launch=None, slot_names=None,
                                blade_power_states=None):
                        '''
                        Manage a Dell Chassis.
                    Severity: Minor
                    Found in salt/states/dellchassis.py - About 1 hr to fix

                      Function detached has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def detached(name,
                                 rev,
                                 target=None,
                                 remote='origin',
                                 user=None,
                      Severity: Minor
                      Found in salt/states/git.py - About 1 hr to fix

                        Function latest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        def latest(name,
                                   rev='HEAD',
                                   target=None,
                                   branch=None,
                                   user=None,
                        Severity: Minor
                        Found in salt/states/git.py - About 1 hr to fix

                          Function bootstrap has 34 lines of code (exceeds 25 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 1 hr to fix

                            Function bootstrap has 34 lines of code (exceeds 25 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 1 hr to fix

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

                              def create(vm_):
                                  r'''
                                  Create a single VM from a data dict.
                              
                                  vm\_
                              Severity: Minor
                              Found in salt/cloud/clouds/opennebula.py - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                                        } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
                                                            diff = cache[1];
                                
                                                        // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
                                                        } else {
                                Severity: Critical
                                Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                      if ((policy_rule_json or policy_rule_file) and
                                         (policy_type or mode or display_name or description or metadata or parameters)):
                                          ret['comment'] = 'Policy definitions cannot be passed when "policy_rule_json" or "policy_rule_file" is defined!'
                                          return ret
                                  
                                  
                                  Severity: Critical
                                  Found in salt/states/azurearm_resource.py - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                            if info:
                                                if info['state'] == 'running':
                                                    ret['comment'] = 'Pool {0} exists and is running'.format(name)
                                                else:
                                                    __salt__['virt.pool_start'](name, connection=connection, username=username, password=password)
                                    Severity: Critical
                                    Found in salt/states/virt.py - About 1 hr to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                              if restart and not just_updated:
                                                  comment = 'Restarting{0}: {1}'.format(
                                                      process_type is not None and ' {0}'.format(process_type) or '',
                                                      name
                                                  )
                                      Severity: Critical
                                      Found in salt/states/supervisord.py - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language