emory-libraries/eulfedora

View on GitHub
eulfedora/api.py

Summary

Maintainability
F
6 days
Test Coverage

File api.py has 766 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# file eulfedora/api.py
#
#   Copyright 2010,2011 Emory University Libraries
#
#   Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in eulfedora/api.py - About 1 day to fix

    Cyclomatic complexity is too high in method addDatastream. (17)
    Open

        def addDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None,
            controlGroup=None, dsLocation=None, altIDs=None, versionable=None,
            dsState=None, formatURI=None, checksumType=None, checksum=None, content=None):
            '''Add a new datastream to an existing object.  On success,
            the return response should have a status of 201 Created;
    Severity: Minor
    Found in eulfedora/api.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method modifyDatastream. (15)
    Open

        def modifyDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None, dsLocation=None,
            altIDs=None, versionable=None, dsState=None, formatURI=None, checksumType=None,
            checksum=None, content=None, force=False):
            '''Modify an existing datastream, similar to :meth:`addDatastraem`.
            Content can be specified by either a URI location or as
    Severity: Minor
    Found in eulfedora/api.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method upload. (13)
    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 by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    REST_API has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class REST_API(HTTP_API_Base):
        """Python object for accessing
        `Fedora's REST API <https://wiki.duraspace.org/display/FEDORA38/REST+API>`_.
    
        Most methods return an HTTP :class:`requests.models.Response`, which
    Severity: Minor
    Found in eulfedora/api.py - About 2 hrs to fix

      Function addDatastream has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def addDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None,
              controlGroup=None, dsLocation=None, altIDs=None, versionable=None,
              dsState=None, formatURI=None, checksumType=None, checksum=None, content=None):
              '''Add a new datastream to an existing object.  On success,
              the return response should have a status of 201 Created;
      Severity: Minor
      Found in eulfedora/api.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

      Cyclomatic complexity is too high in method _query. (9)
      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 by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function modifyDatastream has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def modifyDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None, dsLocation=None,
              altIDs=None, versionable=None, dsState=None, formatURI=None, checksumType=None,
              checksum=None, content=None, force=False):
              '''Modify an existing datastream, similar to :meth:`addDatastraem`.
              Content can be specified by either a URI location or as
      Severity: Minor
      Found in eulfedora/api.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

      Cyclomatic complexity is too high in method findObjects. (8)
      Open

          def findObjects(self, query=None, terms=None, pid=True, chunksize=None, session_token=None):
              """
              Wrapper function for `Fedora REST API findObjects <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-findObjects>`_
              and `Fedora REST API resumeFindObjects <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-resumeFindObjects>`_
      
      
      Severity: Minor
      Found in eulfedora/api.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _make_request. (6)
      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 by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      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 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 _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 _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 purgeDatastream has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def purgeDatastream(self, pid, dsID, startDT=None, endDT=None, logMessage=None,
          Severity: Minor
          Found in eulfedora/api.py - About 45 mins to fix

            Function purgeRelationship has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def purgeRelationship(self, pid, subject, predicate, object, isLiteral=False,
            Severity: Minor
            Found in eulfedora/api.py - About 45 mins to fix

              Function getDatastreamDissemination has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def getDatastreamDissemination(self, pid, dsID, asOfDateTime=None, stream=False,
              Severity: Minor
              Found in eulfedora/api.py - About 45 mins to fix

                Function addRelationship has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def addRelationship(self, pid, subject, predicate, object, isLiteral=False,
                Severity: Minor
                Found in eulfedora/api.py - About 45 mins to fix

                  Function modifyObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def modifyObject(self, pid, label, ownerId, state, logMessage=None):
                  Severity: Minor
                  Found in eulfedora/api.py - About 35 mins to fix

                    Function export has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def export(self, pid, context=None, format=None, encoding=None,
                    Severity: Minor
                    Found in eulfedora/api.py - About 35 mins to fix

                      Function find_statements has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def find_statements(self, query, language='spo', type='triples', flush=None,
                      Severity: Minor
                      Found in eulfedora/api.py - About 35 mins to fix

                        Function findObjects has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def findObjects(self, query=None, terms=None, pid=True, chunksize=None, session_token=None):
                        Severity: Minor
                        Found in eulfedora/api.py - About 35 mins to fix

                          Function findObjects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def findObjects(self, query=None, terms=None, pid=True, chunksize=None, session_token=None):
                                  """
                                  Wrapper function for `Fedora REST API findObjects <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-findObjects>`_
                                  and `Fedora REST API resumeFindObjects <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-resumeFindObjects>`_
                          
                          
                          Severity: Minor
                          Found in eulfedora/api.py - About 35 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

                          FIXME found
                          Open

                                  elif "'" in val:    # FIXME: need better handling for literal strings
                          Severity: Minor
                          Found in eulfedora/api.py by fixme

                          TODO found
                          Open

                                          # TODO: when we can return url contents as file-like objects, use that
                          Severity: Minor
                          Found in eulfedora/api.py by fixme

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

                              def setDatastreamState(self, pid, dsID, dsState):
                                  '''Update datastream state.
                          
                                  :param pid: object pid
                                  :param dsID: datastream id
                          Severity: Major
                          Found in eulfedora/api.py and 1 other location - About 3 hrs to fix
                          eulfedora/api.py on lines 788..801

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

                          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

                              def setDatastreamVersionable(self, pid, dsID, versionable):
                                  '''Update datastream versionable setting.
                          
                                  :param pid: object pid
                                  :param dsID: datastream id
                          Severity: Major
                          Found in eulfedora/api.py and 1 other location - About 3 hrs to fix
                          eulfedora/api.py on lines 773..786

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

                          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 3 locations. Consider refactoring.
                          Open

                              def get_predicates(self, subject, object):
                                  """
                                  Search for all subjects related to the specified subject and object.
                          
                                  :param subject:
                          Severity: Major
                          Found in eulfedora/api.py and 2 other locations - About 1 hr to fix
                          eulfedora/api.py on lines 1034..1043
                          eulfedora/api.py on lines 1056..1065

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

                          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 3 locations. Consider refactoring.
                          Open

                              def get_objects(self, subject, predicate):
                                  """
                                  Search for all subjects related to the specified subject and predicate.
                          
                                  :param subject:
                          Severity: Major
                          Found in eulfedora/api.py and 2 other locations - About 1 hr to fix
                          eulfedora/api.py on lines 1034..1043
                          eulfedora/api.py on lines 1045..1054

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

                          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 3 locations. Consider refactoring.
                          Open

                              def get_subjects(self, predicate, object):
                                  """
                                  Search for all subjects related to the specified predicate and object.
                          
                                  :param predicate:
                          Severity: Major
                          Found in eulfedora/api.py and 2 other locations - About 1 hr to fix
                          eulfedora/api.py on lines 1045..1054
                          eulfedora/api.py on lines 1056..1065

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

                          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

                              def listDatastreams(self, pid):
                                  """
                                  Get a list of all datastreams for a specified object.
                          
                                  Wrapper function for `Fedora REST API listDatastreams <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-listDatastreams>`_
                          Severity: Minor
                          Found in eulfedora/api.py and 1 other location - About 45 mins to fix
                          eulfedora/api.py on lines 251..259

                          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

                              def getObjectHistory(self, pid):
                                  '''Get the history for an object in XML format.
                          
                                  :param pid: object pid
                                  :rtype: :class:`requests.models.Response`
                          Severity: Minor
                          Found in eulfedora/api.py and 1 other location - About 45 mins to fix
                          eulfedora/api.py on lines 278..291

                          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

                          There are no issues that match your filters.

                          Category
                          Status