Showing 75 of 182 total issues
File models.py
has 1524 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulfedora/models.py
#
# Copyright 2010,2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");
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");
Function raw_datastream_old
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def raw_datastream_old(request, pid, dsid, type=None, repo=None,
headers=None, accept_range_request=False,
as_of_date=None, streaming=False):
'''
.. NOTE::
- Read upRead up
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
DigitalObject
has 57 functions (exceeds 20 allowed). Consider refactoring. Open
class DigitalObject(six.with_metaclass(DigitalObjectType, object)):
"""
A single digital object in a Fedora respository, with methods and
properties to easy creating, accessing, and updating a Fedora
object or any of its component parts, with pre-defined datastream
File views.py
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulfedora/views.py
#
# Copyright 2010,2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");
Function load_initial_objects
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def load_initial_objects(self):
# look for any .xml files in apps under fixtures/initial_objects
# and attempt to load them as Fedora objects
# NOTE! any fixtures should have pids specified, or new versions of the
# fixture will be created every time syncrepo runs
- Read upRead up
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 save
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def save(self, logmessage=None):
"""Save datastream content and any changed datastream profile
information to Fedora.
:rtype: boolean for success
- Read upRead up
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
DatastreamObject
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class DatastreamObject(object):
"""Object to ease accessing and updating a datastream belonging to a Fedora
object. Handles datastream content as well as datastream profile information.
Content and datastream info are only pulled from Fedora when content and info
fields are accessed.
File syncutil.py
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulfedora/syncutil.py
#
# Copyright 2016 Emory University Libraries & IT Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
Function object_data
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def object_data(self):
'''Process the archival export and return a buffer with foxml
content for ingest into the destination repository.
:returns: :class:`io.BytesIO` for ingest, with references
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File server.py
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulfedora/server.py
#
# Copyright 2010,2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");
Function find_objects
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def find_objects(self, terms=None, type=None, chunksize=None, **kwargs):
"""
Find objects in Fedora. Find query should be generated via keyword
args, based on the fields in Fedora documentation. By default, the
query uses a contains (~) search for all search terms. Calls
- Read upRead up
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 best_subtype_for_object
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def best_subtype_for_object(self, obj, content_models=None):
"""Given a :class:`~eulfedora.models.DigitalObject`, examine the
object to select the most appropriate subclass to instantiate. This
generic implementation examines the object's content models and
compares them against the defined subclasses of
- Read upRead up
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 25 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, root=None, username=None, password=None, request=None,
retries=default_retry_option):
# when initialized via django, settings should be pulled from django conf
if root is None:
- Read upRead up
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 encoded_datastream
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def encoded_datastream(self):
'''Generator for datastream content. Takes a list of sections
of data within the current chunk (split on binaryContent start and
end tags), runs a base64 decode, and yields the data. Computes
datastream size and MD5 as data is decoded for sanity-checking
- Read upRead up
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
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
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;
- Read upRead up
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_range_content
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_range_content(ds, start, end):
'''Generator for range-requested datastream content. Iterates over
datastream content in chunks, and yields the chunks (or partial chunks)
that are part of the requested range.'''
if not end or end > ds.info.size:
- Read upRead up
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 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
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File xml.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulfedora/xml.py
#
# Copyright 2010,2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");