saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function get_proc_dir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def get_proc_dir(cachedir, **kwargs):
    '''
    Given the cache directory, return the directory that process data is
    stored in, creating it if it doesn't exist.
    The following optional Keyword Arguments are handled:
Severity: Minor
Found in salt/minion.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 _find_file_meta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _find_file_meta(metadata, bucket_name, saltenv, path):
    '''
    Looks for a file's metadata in the S3 bucket cache file
    '''
    env_meta = metadata[saltenv] if saltenv in metadata else {}
Severity: Minor
Found in salt/fileserver/s3fs.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 lock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def lock(self, back=None, remote=None):
        '''
        ``remote`` can either be a dictionary containing repo configuration
        information, or a pattern. If the latter, then remotes for which the URL
        matches the pattern will be locked.
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 applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  , applyPlacement: function(offset, placement){
      var $tip = this.tip()
        , width = $tip[0].offsetWidth
        , height = $tip[0].offsetHeight
        , actualWidth
Severity: Minor
Found in doc/_themes/saltstack/static/js/vendor/bootstrap.js - About 1 hr to fix

    Function cib_present has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def cib_present(name, cibname, scope=None, extra_args=None):
        '''
        Ensure that a CIB-file with the content of the current live CIB is created
    
        Should be run on one cluster node only
    Severity: Minor
    Found in salt/states/pcs.py - About 1 hr to fix

      Function render_jinja_tmpl has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def render_jinja_tmpl(tmplstr, context, tmplpath=None):
          opts = context['opts']
          saltenv = context['saltenv']
          loader = None
          newline = False
      Severity: Minor
      Found in salt/utils/templates.py - About 1 hr to fix

        Function _run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def _run(cmd,
                 cwd=None,
                 stdin=None,
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE,
        Severity: Minor
        Found in salt/modules/cmdmod.py - About 1 hr to fix

          Function create_certificate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def create_certificate(
                  path=None, text=False, overwrite=True, ca_server=None, **kwargs):
              '''
              Create an X509 certificate.
          
          
          Severity: Minor
          Found in salt/modules/x509.py - About 1 hr to fix

            Function query has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def query(action=None,
                      command=None,
                      args=None,
                      method='GET',
                      location=None,
            Severity: Minor
            Found in salt/cloud/clouds/joyent.py - About 1 hr to fix

              Function handlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  handlers: function( event, handlers ) {
                      var sel, handleObj, matches, i,
                          handlerQueue = [],
                          delegateCount = handlers.delegateCount,
                          cur = event.target;
              Severity: Minor
              Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

                Function injectElementWithStyles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    injectElementWithStyles = function( rule, callback, nodes, testnames ) {
                
                      var style, ret, node, docOverflow,
                          div = document.createElement('div'),
                                body = document.body,

                  Function h has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function h(a, b) {
                              function c(a, c) {
                                  if (a) {
                                      if (e(a)) c || (j = function () {
                                          var a = [].slice.call(arguments);

                    Function promise has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    jQuery.ready.promise = function( obj ) {
                        if ( !readyList ) {
                    
                            readyList = jQuery.Deferred();
                    
                    
                    Severity: Minor
                    Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 1 hr to fix

                      Function _changes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def _changes(name,
                                   uid=None,
                                   gid=None,
                                   groups=None,
                                   optional_groups=None,
                      Severity: Minor
                      Found in salt/states/user.py - About 1 hr to fix

                        Function query has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        def query(key, keyid, method='GET', params=None, headers=None,
                                  requesturl=None, return_url=False, bucket=None, service_url=None,
                                  path='', return_bin=False, action=None, local_file=None,
                                  verify_ssl=True, full_headers=False, kms_keyid=None,
                                  location=None, role_arn=None, chunk_size=16384, path_style=False,
                        Severity: Minor
                        Found in salt/utils/s3.py - About 1 hr to fix

                          Function create_csr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          def create_csr(ca_name,
                                         bits=2048,
                                         CN='localhost',
                                         C='US',
                                         ST='Utah',
                          Severity: Minor
                          Found in salt/modules/tls.py - About 1 hr to fix

                            Function create_self_signed_cert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            def create_self_signed_cert(tls_dir='tls',
                                                        bits=2048,
                                                        days=365,
                                                        CN='localhost',
                                                        C='US',
                            Severity: Minor
                            Found in salt/modules/tls.py - About 1 hr to fix

                              Function pkg has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              def pkg(pkg_path,
                                      pkg_sum,
                                      hash_type,
                                      test=None,
                                      **kwargs):
                              Severity: Minor
                              Found in salt/modules/state.py - About 1 hr to fix

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

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

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

                                  def create(vm_):
                                      '''
                                      Create a single VM from a data dict
                                      '''
                                      if 'driver' not in vm_:
                                  Severity: Minor
                                  Found in salt/cloud/clouds/vultrpy.py - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language