saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Avoid deeply nested control flow statements.
Open

                            with salt.utils.files.fopen(cache_dest, 'wb+') as ofile:
                                ofile.write(data['data'])
                    if 'hsum' in data and d_tries < 3:
Severity: Major
Found in salt/fileclient.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ( matches[ sel ] ) {
                                matches.push( handleObj );
                            }
    Severity: Major
    Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if ( Expr.relative[ tokens[j].type ] ) {
                              break;
                          }
      Severity: Major
      Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if ( deleteExpando ) {
                                    delete elem[ internalKey ];
        
                                } else if ( typeof elem.removeAttribute !== core_strundefined ) {
                                    elem.removeAttribute( internalKey );
        Severity: Major
        Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if self.pillar_keys:
                                      for key in self.pillar_keys:
                                          if key in total['pillar']:
                                              cache['pillar'][minion][key] = total['pillar'][key]
                                  else:
          Severity: Major
          Found in salt/thorium/__init__.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if self.opts.get('auth_events') is True:
                                        self.event.fire_event(eload, salt.utils.event.tagify(prefix='auth'))
                                    return {'enc': 'clear',
            Severity: Major
            Found in salt/transport/mixins/auth.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if 'encoding' in field:
                                                  encoding = field.split('encoding=')[-1]
                                          write_body[2] = encoding
              Severity: Major
              Found in salt/fileclient.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if self.grain_keys:
                                            for key in self.grain_keys:
                                                if key in total['grains']:
                                                    cache['grains'][minion][key] = total['grains'][key]
                                        else:
                Severity: Major
                Found in salt/thorium/__init__.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if ( elem.id !== match[2] ) {
                                              return rootjQuery.find( selector );
                                          }
                  Severity: Major
                  Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

                    Function decode_dict_keys_to_str has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def decode_dict_keys_to_str(src):
                        '''
                        Convert top level keys from bytes to strings if possible.
                        This is necessary because Python 3 makes a distinction
                        between these types.
                    Severity: Minor
                    Found in salt/fileclient.py - About 45 mins 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

                    Avoid deeply nested control flow statements.
                    Open

                                        if ( conv && s["throws"] ) {
                                            response = conv( response );
                                        } else {
                                            try {
                                                response = conv( response );
                    Severity: Major
                    Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                          if ( typeof xhr.responseText === "string" ) {
                                                              responses.text = xhr.responseText;
                                                          }
                      Severity: Major
                      Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if tcp_keepalive_intvl <= 0:
                                                tcp_keepalive_intvl = 1
                                            # The values expected are in milliseconds, so multiply by
                                            # 1000.
                                            sock.ioctl(socket.SIO_KEEPALIVE_VALS, (
                        Severity: Major
                        Found in salt/transport/tcp.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if this_password == __salt__['hashutil.digest'](password, hashtype):
                                                  return True
                          
                                          # Short circuit if we've already found the user but the password was wrong
                                          return False
                          Severity: Major
                          Found in salt/auth/file.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
                                                                // Cache the index of each encountered element
                                                                if ( useCache ) {
                                                                    (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
                                                                }
                            Severity: Major
                            Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if ( (seed = find(
                                                      token.matches[0].replace( runescape, funescape ),
                                                      rsibling.test( tokens[0].type ) && context.parentNode || context
                                                  )) ) {
                              
                              
                              Severity: Major
                              Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        while ( j-- ) {
                                                            if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
                                                                elem.removeChild( tbody );
                                                            }
                                                        }
                                Severity: Major
                                Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if req.status_code == 200:
                                                                  with open(fdest, 'wb') as wfh:
                                                                      for chunk in req.iter_content(chunk_size=4096):
                                                                          if chunk:  # filter out keep-alive new chunks
                                                                              wfh.write(chunk)
                                  Severity: Major
                                  Found in setup.py - About 45 mins to fix

                                    Function close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def close(self):
                                            '''
                                            Since the message_client creates sockets and assigns them to the IOLoop we have to
                                            specifically destroy them, since we aren't the only ones with references to the FDs
                                            '''
                                    Severity: Minor
                                    Found in salt/transport/zeromq.py - About 45 mins 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

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if self.opts.get('auth_events') is True:
                                                                self.event.fire_event(eload, salt.utils.event.tagify(prefix='auth'))
                                                            return {'enc': 'clear',
                                    Severity: Major
                                    Found in salt/transport/mixins/auth.py - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language