scitran/core

View on GitHub

Showing 294 of 518 total issues

Avoid too many return statements within this function.
Open

        return Job.load(result)
Severity: Major
Found in api/jobs/queue.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return False
    Severity: Major
    Found in api/jobs/rules.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return True
      Severity: Major
      Found in api/jobs/rules.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return False
        Severity: Major
        Found in api/jobs/rules.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return True
          Severity: Major
          Found in api/dao/hierarchy.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return noop
            Severity: Major
            Found in api/dao/consistencychecker.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return True
              Severity: Major
              Found in api/download.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return self.create_el(payload)
                Severity: Major
                Found in api/dao/basecontainerstorage.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return 'Parallel failed: update doc ' + str(job['_id']) + ' resulted modified ' + str(result.modified_count)
                  Severity: Major
                  Found in bin/database.py - About 30 mins to fix

                    Function get_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_status(self):
                            devices = self.storage.get_all_el(None, None, None)
                            response = {}
                            now = dt.datetime.now()
                            for d in devices:
                    Severity: Minor
                    Found in api/handlers/devicehandler.py - About 25 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 lintSchema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    SchemaLinter.prototype.lintSchema = function(linters, schema, filename) {
                        var results = [];
                    
                        if( schema['x-lint'] === false ) {
                            return results;
                    Severity: Minor
                    Found in swagger/support/schema-lint.js - About 25 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 join_user_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def join_user_info(results):
                            """
                            Given a list of containers, adds avatar and name context to each member of the permissions and notes lists
                            """
                    
                    
                    Severity: Minor
                    Found in api/handlers/containerhandler.py - About 25 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 _propagate_permissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _propagate_permissions(self, cont_name, _id, query=None, update=None):
                            """
                            method to propagate permissions from a container/group to its sessions and acquisitions
                            """
                            if cont_name == 'groups':
                    Severity: Minor
                    Found in api/handlers/listhandler.py - About 25 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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get(self, cid):
                            """List rules"""
                    
                            projection = None
                    
                    
                    Severity: Minor
                    Found in api/jobs/handlers.py - About 25 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 validate_gear_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def validate_gear_config(gear, config_):
                        if len(gear.get('manifest', {}).get('config', {})) > 0:
                            invocation = gear_tools.derive_invocation_schema(gear['manifest'])
                            ci = gear_tools.isolate_config_invocation(invocation)
                            validator = Draft4Validator(ci)
                    Severity: Minor
                    Found in api/jobs/gears.py - About 25 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 check_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def check_state(batch_id):
                        """
                        Returns state of batch based on state of each of its jobs
                        are complete or failed
                        """
                    Severity: Minor
                    Found in api/jobs/batch.py - About 25 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 get_statistics has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_statistics(tags=None, last=None, unique=False, all_flag=False):
                            """
                            Return a variety of interesting information about the job queue.
                            """
                    
                    
                    Severity: Minor
                    Found in api/jobs/queue.py - About 25 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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def build(self):
                            query = {}
                    
                            if self.start_date or self.end_date:
                                query['created'] = {}
                    Severity: Minor
                    Found in api/handlers/reporthandler.py - About 25 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 get_all_for_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_all_for_user(self, cont_name, uid):
                            self.config = self.container_handler_configurations[cont_name]
                            self.storage = self.config['storage']
                            projection = self.config['list_projection']
                            # select which permission filter will be applied to the list of results.
                    Severity: Minor
                    Found in api/handlers/containerhandler.py - About 25 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 list_permission_checker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def list_permission_checker(handler):
                        def g(exec_op):
                            def f(method, query=None, user=None, public=False, projection=None):
                                if user and (user['_id'] != handler.uid):
                                    handler.abort(403, 'User ' + handler.uid + ' may not see the Projects of User ' + user['_id'])
                    Severity: Minor
                    Found in api/auth/containerauth.py - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language