scitran/core

View on GitHub

Showing 518 of 518 total issues

Avoid deeply nested control flow statements.
Open

                    if( !this.validateName(k) ) {
                        errors.push(new LintError('Invalid definition name: "' + k + '"', filename));
                    }
Severity: Major
Found in swagger/support/schema-lint.js - About 45 mins to fix

    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 y.get('_id') == self.uid:
                                ok = True
                                break
    
    
    Severity: Major
    Found in api/handlers/resolvehandler.py - About 45 mins to fix

      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

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

            def validate_user(self, openid, registration_code=None):
                if registration_code:
                    user = config.db.users.find_one({'wechat.registration_code': registration_code})
                    if user is None:
                        raise APIUnknownUserException('Invalid or expired registration link.')
        Severity: Minor
        Found in api/auth/authproviders.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( 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

          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 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

              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

              Avoid deeply nested control flow statements.
              Open

                                      if c.get('inputs') is None:
                                          c['inputs'] = {}
              
              
              Severity: Major
              Found in api/jobs/handlers.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if measurement:
                                            f['measurements'] = [measurement]
                                        if info:
                Severity: Major
                Found in api/placer.py - About 45 mins to fix

                  Similar blocks of code found in 9 locations. Consider refactoring.
                  Open

                          if payload.get('timestamp'):
                              payload['timestamp'] = dateutil.parser.parse(payload['timestamp'])
                  Severity: Major
                  Found in api/handlers/listhandler.py and 8 other locations - About 45 mins to fix
                  api/dao/hierarchy.py on lines 512..513
                  api/dao/hierarchy.py on lines 531..532
                  api/handlers/containerhandler.py on lines 436..437
                  api/handlers/containerhandler.py on lines 484..485
                  api/handlers/listhandler.py on lines 298..299
                  bin/oneoffs/load_external_data.py on lines 32..33
                  bin/oneoffs/load_external_data.py on lines 34..35
                  bin/oneoffs/load_external_data.py on lines 36..37

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if user_perm.get('access') != 'admin':
                              result['permissions'] = [user_perm] if user_perm else []
                  Severity: Minor
                  Found in api/handlers/containerhandler.py and 1 other location - About 45 mins to fix
                  api/handlers/grouphandler.py on lines 111..112

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if user_perm.get('access') != 'admin':
                                  result['permissions'] = [user_perm] if user_perm else []
                  Severity: Minor
                  Found in api/handlers/grouphandler.py and 1 other location - About 45 mins to fix
                  api/handlers/containerhandler.py on lines 219..220

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if 'timestamp' in insert_map:
                              insert_map['timestamp'] = dateutil.parser.parse(insert_map['timestamp'])
                  Severity: Minor
                  Found in api/placer.py and 1 other location - About 45 mins to fix
                  api/placer.py on lines 663..664

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              pipeline = [
                                  {'$match': subject_q},
                                  {'$group': {'_id': '$subject._id'}},
                                  {'$group': {'_id': 1, 'count': { '$sum': 1 }}}
                  Severity: Minor
                  Found in api/handlers/reporthandler.py and 1 other location - About 45 mins to fix
                  api/dao/containerutil.py on lines 138..141

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                  def upgrade_to_30_closure_analysis(coll_item, coll):
                      analyses = coll_item.get('analyses', [])
                  
                      for analysis_ in analyses:
                          files = analysis_.get('files', [])
                  Severity: Minor
                  Found in bin/database.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

                  Similar blocks of code found in 9 locations. Consider refactoring.
                  Open

                          if payload.get('timestamp'):
                              payload['timestamp'] = dateutil.parser.parse(payload['timestamp'])
                  Severity: Major
                  Found in api/handlers/listhandler.py and 8 other locations - About 45 mins to fix
                  api/dao/hierarchy.py on lines 512..513
                  api/dao/hierarchy.py on lines 531..532
                  api/handlers/containerhandler.py on lines 436..437
                  api/handlers/containerhandler.py on lines 484..485
                  api/handlers/listhandler.py on lines 282..283
                  bin/oneoffs/load_external_data.py on lines 32..33
                  bin/oneoffs/load_external_data.py on lines 34..35
                  bin/oneoffs/load_external_data.py on lines 36..37

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 9 locations. Consider refactoring.
                  Open

                      if c_metadata.get('timestamp'):
                          c_metadata['timestamp'] = dateutil.parser.parse(c_metadata['timestamp'])
                  Severity: Major
                  Found in api/dao/hierarchy.py and 8 other locations - About 45 mins to fix
                  api/dao/hierarchy.py on lines 531..532
                  api/handlers/containerhandler.py on lines 436..437
                  api/handlers/containerhandler.py on lines 484..485
                  api/handlers/listhandler.py on lines 282..283
                  api/handlers/listhandler.py on lines 298..299
                  bin/oneoffs/load_external_data.py on lines 32..33
                  bin/oneoffs/load_external_data.py on lines 34..35
                  bin/oneoffs/load_external_data.py on lines 36..37

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 9 locations. Consider refactoring.
                  Open

                              if session.get('timestamp'):
                                  session['timestamp'] = dateutil.parser.parse(session['timestamp'])
                  Severity: Major
                  Found in api/dao/hierarchy.py and 8 other locations - About 45 mins to fix
                  api/dao/hierarchy.py on lines 512..513
                  api/handlers/containerhandler.py on lines 436..437
                  api/handlers/containerhandler.py on lines 484..485
                  api/handlers/listhandler.py on lines 282..283
                  api/handlers/listhandler.py on lines 298..299
                  bin/oneoffs/load_external_data.py on lines 32..33
                  bin/oneoffs/load_external_data.py on lines 34..35
                  bin/oneoffs/load_external_data.py on lines 36..37

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 35.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language