scitran/core

View on GitHub

Showing 294 of 518 total issues

File database.py has 1099 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

import argparse
import bson
import copy
Severity: Major
Found in bin/database.py - About 2 days to fix

    Function is_session_compliant has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_session_compliant(session, template):
        """
        Given a project-level session template and a session,
        returns True/False if the session is in compliance with the template
        """
    Severity: Minor
    Found in api/dao/hierarchy.py - About 1 day 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

    File dataexplorerhandler.py has 710 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import copy
    import json
    
    from elasticsearch import ElasticsearchException, TransportError, RequestError, helpers
    
    
    Severity: Major
    Found in api/handlers/dataexplorerhandler.py - About 1 day to fix

      File reporthandler.py has 704 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import bson
      import copy
      import unicodecsv as csv
      import datetime
      import dateutil
      Severity: Major
      Found in api/handlers/reporthandler.py - About 1 day to fix

        Function upgrade_to_21 has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
        Open

        def upgrade_to_21():
            """
            scitran/core issue #189 - Data Model v2
        
            Field `metadata` renamed to `info`
        Severity: Minor
        Found in bin/database.py - About 1 day 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 65 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, cont_name, list_name, **kwargs):
                _id = kwargs.pop('cid')
                permchecker, storage, _, _, keycheck = self._initialize_request(cont_name, list_name, _id)
                list_name = storage.list_name
                filename = kwargs.get('name')
        Severity: Minor
        Found in api/handlers/listhandler.py - About 1 day 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

        File listhandler.py has 561 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import os
        import bson
        import copy
        import datetime
        import dateutil
        Severity: Major
        Found in api/handlers/listhandler.py - About 1 day to fix

          Function download has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
          Open

              def download(self, **kwargs):
                  """
                  .. http:get:: /api/(cont_name)*/(cid)*/analyses/(analysis_id)/{filegroup:inputs|files}/(filename)*
          
                      * - not required
          Severity: Minor
          Found in api/handlers/refererhandler.py - About 1 day 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 exports has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function(grunt) {
              var path = require('path');
              var fs = require('fs');
              var _ = require('lodash');
              var yaml = require('js-yaml');
          Severity: Minor
          Found in swagger/support/tasks/simplify-swagger.js - About 1 day 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

          File handlers.py has 533 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
          API request handlers for the jobs module
          """
          import bson
          import copy
          Severity: Major
          Found in api/jobs/handlers.py - About 1 day to fix

            File placer.py has 532 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import bson
            import copy
            import datetime
            import dateutil
            import os
            Severity: Major
            Found in api/placer.py - About 1 day to fix

              Function _preflight_archivestream has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _preflight_archivestream(self, req_spec, collection=None):
                      data_path = config.get_item('persistent', 'data_path')
                      arc_prefix = self.get_param('prefix', 'scitran')
                      file_cnt = 0
                      total_size = 0
              Severity: Minor
              Found in api/download.py - About 1 day 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 exports has 213 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function(grunt) {
                  var path = require('path');
                  var fs = require('fs');
                  var _ = require('lodash');
                  var yaml = require('js-yaml');
              Severity: Major
              Found in swagger/support/tasks/simplify-swagger.js - About 1 day to fix

                File containerhandler.py has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import bson
                import datetime
                import dateutil
                
                from .. import config
                Severity: Major
                Found in api/handlers/containerhandler.py - About 1 day to fix

                  Function _parse_request has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _parse_request(self, request_type='search'):
                  
                          try:
                              request = self.request.json_body
                          except (ValueError):
                  Severity: Minor
                  Found in api/handlers/dataexplorerhandler.py - About 7 hrs 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

                  File hierarchy.py has 475 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import bson
                  import copy
                  import datetime
                  import dateutil.parser
                  import difflib
                  Severity: Minor
                  Found in api/dao/hierarchy.py - About 7 hrs to fix

                    Function resolve has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def resolve(self):
                            """Resolve a path through the hierarchy."""
                    
                            if self.public_request:
                                self.abort(403, 'Request requires login')
                    Severity: Minor
                    Found in api/handlers/resolvehandler.py - About 5 hrs 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

                    File containerstorage.py has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import datetime
                    
                    import bson
                    import copy
                    
                    
                    Severity: Minor
                    Found in api/dao/containerstorage.py - About 5 hrs to fix

                      Function initialization_auth has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def initialization_auth(self):
                              drone_request = False
                              job_context = None
                              session_token = self.request.headers.get('Authorization', None)
                              drone_secret = self.request.headers.get('X-SciTran-Auth', None)
                      Severity: Minor
                      Found in api/web/base.py - About 5 hrs 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

                      File dicom_doctype.py has 378 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      #!/usr/bin/env python
                      
                      import ast
                      import copy
                      import dateutil.parser
                      Severity: Minor
                      Found in bin/dicom_doctype.py - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language