scitran/core

View on GitHub

Showing 294 of 518 total issues

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

def create_mappings():
    public_dict = dicom._dicom_dict.DicomDictionary
    field_mappings = {}
    for k,v in public_dict.iteritems():
        vr_type = v[0]
Severity: Minor
Found in bin/dicom_doctype.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 users has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def users(filepath, api_url, http_headers, insecure):
    """
    Upserts the users/groups/permissions defined in filepath parameter.

    Raises:
Severity: Minor
Found in bin/load_users_drone_secret.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 extract_file_fields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def extract_file_fields(form):
    """Returns a list of file fields in the form, handling multiple values""" 
    result = []
    for fieldname in form:
        field = form[fieldname]
Severity: Minor
Found in api/upload.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 _upsert_container has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _upsert_container(cont, cont_type, parent, parent_type, upload_type, timestamp):
    cont['modified'] = timestamp

    if cont.get('timestamp'):
        cont['timestamp'] = dateutil.parser.parse(cont['timestamp'])
Severity: Minor
Found in api/dao/hierarchy.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 __init__ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, gear_id, inputs, destination=None, tags=None,
                 attempt=1, previous_job_id=None, created=None,
                 modified=None, state='pending', request=None,
                 id_=None, config_=None, origin=None,
                 saved_files=None, produced_metadata=None, batch=None,
Severity: Minor
Found in api/jobs/jobs.py - About 1 hr to fix

    Function post has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def post(self):
            """
            Create a batch job proposal, insert as 'pending' if there are matched containers
            """
    
    
    Severity: Minor
    Found in api/jobs/handlers.py - About 1 hr to fix

      Function _create_default has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _create_default(self, month=None, year=None, project=None, ignore_minmax=False):
              """
              Returns a zerod out usage report for month/project type usage reports
      
              If proveded with a month and year, adds info to the report as well as updates first and last seen months
      Severity: Minor
      Found in api/handlers/reporthandler.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 map has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def map(self):
              """
              Flatten struct to map
              """
      
      
      Severity: Minor
      Found in api/jobs/jobs.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 put has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def put(self, cid, rid):
              """Change a rule"""
      
              if cid == 'site':
                  if not self.user_is_admin:
      Severity: Minor
      Found in api/jobs/handlers.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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, gear_id, inputs, destination=None, tags=None,
                       attempt=1, previous_job_id=None, created=None,
                       modified=None, state='pending', request=None,
                       id_=None, config_=None, origin=None,
                       saved_files=None, produced_metadata=None, batch=None,
      Severity: Minor
      Found in api/jobs/jobs.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 default_referer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def default_referer(handler, parent_container=None):
          def g(exec_op):
              def f(method, _id=None, payload=None):
                  access = _get_access(handler.uid, parent_container)
                  if method == 'GET' and parent_container.get('public', False):
      Severity: Minor
      Found in api/auth/containerauth.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, report_type):
      
              report = None
      
              if report_type in ReportTypes:
      Severity: Minor
      Found in api/handlers/reporthandler.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 default has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def default(handler, group=None):
          def g(exec_op):
              def f(method, _id=None, query=None, payload=None, projection=None):
                  if handler.superuser_request:
                      pass
      Severity: Minor
      Found in api/auth/groupauth.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 post has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def post(self, cont_name):
              self.config = self.container_handler_configurations[cont_name]
              self.storage = self.config['storage']
              mongo_validator, payload_validator = self._get_validators()
      
      
      Severity: Minor
      Found in api/handlers/containerhandler.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 _add_contents has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _add_contents(self, contents, _id):
              if not contents:
                  return
              acq_ids = []
              for item in contents['nodes']:
      Severity: Minor
      Found in api/handlers/collectionshandler.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 index_field_names has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def index_field_names(self):
      
              try:
                  if not config.es.indices.exists('data_explorer'):
                      self.abort(404, 'data_explorer index not yet available')
      Severity: Minor
      Found in api/handlers/dataexplorerhandler.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 delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def delete(self, cont_name, **kwargs):
              _id = kwargs.pop('cid')
              self.config = self.container_handler_configurations[cont_name]
              self.storage = self.config['storage']
      
      
      Severity: Minor
      Found in api/handlers/containerhandler.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 upgrade_to_27 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def upgrade_to_27():
          """
          scitran/core PR #768
      
          Fix project templates that reference `measurement` instead of `measurements`
      Severity: Minor
      Found in bin/database.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 _update_hierarchy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _update_hierarchy(container, container_type, metadata):
          project_id = container.get('project') # for sessions
          now = datetime.datetime.utcnow()
      
          if container_type == 'acquisition':
      Severity: Minor
      Found in api/dao/hierarchy.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 upgrade_to_33_closure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def upgrade_to_33_closure(cont, cont_name):
          cont_type = cont_name[:-1]
          if cont.get('analyses'):
              for analysis in cont['analyses']:
                  analysis['_id'] = bson.ObjectId(analysis['_id'])
      Severity: Minor
      Found in bin/database.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

      Severity
      Category
      Status
      Source
      Language