emory-libraries/eulfedora

View on GitHub

Showing 75 of 182 total issues

Function __new__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def __new__(cls, name, bases, defined_attrs):
        datastreams = {}
        local_datastreams = {}
        use_attrs = defined_attrs.copy()
        reverse_rels = {}
Severity: Minor
Found in eulfedora/models.py - About 2 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

Function addDatastream has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def addDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None,
Severity: Major
Found in eulfedora/api.py - About 1 hr to fix

    Function modifyDatastream has 14 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def modifyDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None, dsLocation=None,
    Severity: Major
    Found in eulfedora/api.py - About 1 hr to fix

      Function _save_existing has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _save_existing(self, logMessage):
              # save an object that has already been ingested into fedora
      
              # - list of datastreams that should be saved
              to_save = [ds for ds, dsobj in six.iteritems(self.dscache) if dsobj.isModified()]
      Severity: Minor
      Found in eulfedora/models.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 _build_foxml_datastream has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def _build_foxml_datastream(self, E, dsid, dsobj):
      
              # if we can't construct a content node then bail before constructing
              # any other nodes
              content_node = None
      Severity: Minor
      Found in eulfedora/models.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 modify_relationship has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def modify_relationship(self, rel_uri, old_object, new_object):
              """
              Modify a relationship from RELS-EXT for this object.  As the Fedora API-M does not contain
              a native "modifyRelationship", this method purges an existing one, then adds a new one,
              pivoting on the predicate.
      Severity: Minor
      Found in eulfedora/models.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 sync_object has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def sync_object(src_obj, dest_repo, export_context='migrate',
                      overwrite=False, show_progress=False,
                      requires_auth=False, omit_checksums=False,
                      verify=False):
          '''Copy an object from one repository to another using the Fedora
      Severity: Minor
      Found in eulfedora/syncutil.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 upload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def upload(self, data, callback=None, content_type=None,
                     size=None):
              '''
              Upload a multi-part file for content to ingest.  Returns a
              temporary upload id that can be used as a datstream location.
      Severity: Minor
      Found in eulfedora/api.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 binarycontent_sections has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def binarycontent_sections(chunk):
          '''Split a chunk of data into sections by start and end binary
          content tags.'''
          # using string split because it is significantly faster than regex.
      
      
      Severity: Minor
      Found in eulfedora/syncutil.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 getDatastreamObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def getDatastreamObject(self, dsid, dsobj_type=None, as_of_date=None):
              '''Get any datastream on this object as a :class:`DatastreamObject`
              **or** add a new datastream.  If the datastream id corresponds
              to a predefined datastream, the configured object will be returned
              and the datastream object will be returned.  If type is not
      Severity: Minor
      Found in eulfedora/models.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 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, obj, id, label, mimetype=None, versionable=False,
      Severity: Major
      Found in eulfedora/models.py - About 1 hr to fix

        Function raw_datastream_old has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def raw_datastream_old(request, pid, dsid, type=None, repo=None,
        Severity: Major
        Found in eulfedora/views.py - About 1 hr to fix

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

              def _make_request(self, reqmeth, url, *args, **kwargs):
                  # copy base request options and update with any keyword args
                  rqst_options = self.request_options.copy()
                  rqst_options.update(kwargs)
                  start = time.time()
          Severity: Minor
          Found in eulfedora/api.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 _raw_datastream has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def _raw_datastream(request, pid, dsid, repo=None, headers=None,
                 as_of_date=None):
              '''Version of :meth:`raw_datastream` without conditionals, for use
              in class-based views or elsewhere.'''
              if repo is None:
          Severity: Minor
          Found in eulfedora/views.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, response, content=None):
                  # init params:
                  #  response = HttpResponse with the error information
                  #  content = optional content of the response body, if it needed to be read
                  #            to determine what kind of exception to raise
          Severity: Minor
          Found in eulfedora/util.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, api, pid=None, create=False, default_pidspace=None):
                  self.api = api
                  self.dscache = {}       # accessed by DatastreamDescriptor to store and cache datastreams
                  self.relcache = {}      # used by Relation to store and cache related objects
                  self._risearch = None
          Severity: Minor
          Found in eulfedora/models.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 process_class has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_class(self, cls):
                  try:
                      ContentModel.for_class(cls, self.repo)
                  except ValueError as v:
                      # for_class raises a ValueError when a class has >1
          Severity: Minor
          Found in eulfedora/management/commands/syncrepo.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 _query has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _query(self, format, http_args, flush=None):
                  # if flush parameter was not specified, use class setting
                  if flush is None:
                      flush = self.RISEARCH_FLUSH_ON_QUERY
                  http_args['flush'] = 'true' if flush else 'false'
          Severity: Minor
          Found in eulfedora/api.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 sync_object has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def sync_object(src_obj, dest_repo, export_context='migrate',
          Severity: Major
          Found in eulfedora/syncutil.py - About 1 hr to fix

            Function _store_api_info has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _store_api_info(self, sender, time_taken=0, method=None, url=None,
            Severity: Major
            Found in eulfedora/debug_panel.py - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language