scitran/core

View on GitHub

Showing 294 of 518 total issues

Avoid deeply nested control flow statements.
Open

                        if not ticket.get('logged', False):
                            self.log_user_access(AccessType.download_file, cont_name=cont_name, cont_id=cid, filename=fileinfo['name'])
                            config.db.downloads.update_one({'_id': ticket_id}, {'$set': {'logged': True}})
                    else:
Severity: Major
Found in api/handlers/refererhandler.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if isinstance(v, list):
                                v.remove("null")
                            elif isinstance(v, str):
                                v = None
                            null_filter = {
    Severity: Major
    Found in api/handlers/dataexplorerhandler.py - About 45 mins to fix

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

      SchemaTranspiler.prototype._resolveRef = function(schema, defs) {
          var m, ref;
          
          if( !defs ) {
              if( schema.$ref ) {
      Severity: Minor
      Found in swagger/support/schema-transpiler.js - 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( this.defNames[k] ) {
                              errors.push(new LintError('Duplicate definition found: "' + k + '"', filename)); 
                          }
      Severity: Major
      Found in swagger/support/schema-lint.js - About 45 mins to fix

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

        def get_rules_for_container(db, container):
            """
            Recursively walk the hierarchy until the project object is found.
            """
        
        
        Severity: Minor
        Found in api/jobs/rules.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 not isinstance(cf[x], bool):
                                    r['target']['env']['FW_CONFIG_' + config_name] = str(cf[x])
                                else:
                                    r['target']['env']['FW_CONFIG_' + config_name] = str(cf[x]).lower()
        
        
        Severity: Major
        Found in api/jobs/jobs.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if len(k.split('.')) > 1:
                                      null_filter['bool']['should'][0]['bool']['must'].append({'exists': {'field': k.split('.')[0]}})
                                  if v:
          Severity: Major
          Found in api/handlers/dataexplorerhandler.py - About 45 mins to fix

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

                def build(self):
                    query = {}
            
                    if self.uid:
                        query['origin.id'] = self.uid
            Severity: Minor
            Found in api/handlers/reporthandler.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 parsed_url.port != 443:
                                        api_key = parsed_url.hostname + ':' + str(parsed_url.port) + ':' + api_key
                                    else:
                                        api_key = parsed_url.hostname + ':' + api_key
            
            
            Severity: Major
            Found in api/jobs/handlers.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if cached_gears.get(gear_id, None) is not None:
                                          gear_name = cached_gears[gear_id]
                                      else:
                                          gear_id_bson = bson.ObjectId(gear_id)
                                          gear = config.db.gears.find_one({'_id': gear_id_bson})
              Severity: Major
              Found in api/handlers/containerhandler.py - About 45 mins to fix

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

                    def aggregate_field_values(self):
                        """
                        Return list of type ahead values for a key given a value
                        that the user has already started to type in for the value of
                        a custom string field or a set of statistics if the field type is
                Severity: Minor
                Found in api/handlers/dataexplorerhandler.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 j.origin['type'] != 'user':
                                            raise Exception('Cannot provide an API key to a job not launched by a user')
                
                
                Severity: Major
                Found in api/jobs/handlers.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if last > fileinfo['size']:
                                                  length = fileinfo['size'] - first
                                              else:
                                                  length = last - first + 1
                  
                  
                  Severity: Major
                  Found in api/handlers/listhandler.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if y.get('_id') == self.uid:
                                                ok = True
                                                break
                                    else:
                    Severity: Major
                    Found in api/handlers/resolvehandler.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if match is None:
                                              raise Exception("No type " + match_type + " found for alg rule " + alg_name + " that should have been satisfied")
                                          inputs[input_name] = FileReference(type=container_type, id=str(container['_id']), name=match['name'])
                      Severity: Major
                      Found in api/jobs/rules.py - About 45 mins to fix

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

                            def get(self, cont_name, **kwargs):
                                _id = kwargs.get('cid')
                                self.config = self.container_handler_configurations[cont_name]
                                self.storage = self.config['storage']
                                container = self._get_container(_id)
                        Severity: Minor
                        Found in api/handlers/containerhandler.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

                        Function f has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                def f(method, _id, query_params=None, payload=None, fileinfo=None, exclude_params=None):
                        Severity: Minor
                        Found in api/auth/listauth.py - About 45 mins to fix

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

                          function validateTemplateArgs(tmplpath, template, args) {
                              var i, param;
                              if( !template || !template.parameters ) {
                                  return;
                              }
                          Severity: Minor
                          Found in swagger/support/swagger-resolver.js - 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

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

                              def _initialize_request(self, cont_name, list_name, _id, query_params=None):
                                  """
                                  This method loads:
                                  1) the container that will be modified
                                  2) the storage class that will handle the database actions
                          Severity: Minor
                          Found in api/handlers/listhandler.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 v:
                                                      null_filter['bool']['should'].append({'terms': {k+'.raw': v}})
                                                  modified_filters.append(null_filter)
                          Severity: Major
                          Found in api/handlers/dataexplorerhandler.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language