File import_util.py
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Import utility classes for creating :mod:`ppa.archives` records from
external sources.
- Create a ticketCreate a ticket
Function import_digitizedwork
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import_digitizedwork(
self, gale_id, log_msg_src="", user=None, collections=None, **kwargs
):
"""Import a single work into the database.
Retrieves bibliographic data from Gale API."""
- Read upRead up
- Create a ticketCreate a ticket
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 import_digitizedwork
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def import_digitizedwork(
- Create a ticketCreate a ticket
Function rsync_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rsync_data(self):
"""Use rsync to retrieve data for the volumes to be imported."""
# limit the number of ids included in the log message
log_detail = ""
- Read upRead up
- Create a ticketCreate a ticket
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 import_digitizedwork
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import_digitizedwork(self, htid, log_msg_src, user):
# if rsync did not create the expected directory,
# set error code and bail out
# if there is a directory but no zip file, bail out
expected_path = os.path.join(settings.HATHI_DATA, self.pairtree_paths[htid])
- Read upRead up
- Create a ticketCreate a ticket
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"