Showing 53 of 73 total issues
Function add_from_hathi
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_from_hathi(htid, bib_api=None, update=False, log_msg_src=None, user=None):
- Create a ticketCreate a ticket
Function clean
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
"""Add custom validation to trigger a save error in the admin
if someone tries to unsuppress a record that has been suppressed
(not yet supported)."""
if self.has_changed("status") and self.status != self.SUPPRESSED:
- 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 get_description
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_description(self):
"""Get formatted description for preview. Uses description field
if there is content, otherwise uses the beginning of the body content."""
description = ""
- 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 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 initialize_pairtrees
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize_pairtrees(self):
"""Initialize pairtree storage clients for each
subdirectory in the configured **HATHI_DATA** path."""
# if the configured directory does not exist or is not
- 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 process_index_queue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_index_queue(index_data_q, total_to_index, work_q):
"""Function to send index data to Solr. Takes a
queue to poll for index data, a total of the items
to be indexed (for use with progess bar), and a work queue
as a way of checking that all indexing is complete."""
- 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 get_context_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
digwork = context["object"]
# if suppressed, don't do any further processing
- 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"
Further reading
Function source_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def source_link(self, obj):
"""source id as an html link to source record, when source url is available"""
if not obj.source_url:
return obj.source_id
- 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 constructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
constructor(images) {
if ('IntersectionObserver' in window) {
let observer = new IntersectionObserver((items, observer) => {
items.forEach(item => {
if (item.isIntersecting) {
- 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 get_version_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_version_label(htid):
"""
Extract the HathiTrust "version label" from a record's catalog page.
Returns the corresponding timestamp, returns None if the HTTP request fails.
"""
- 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_record
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import_record(self, gale_id, **kwargs):
"""Import a single work into the database.
Retrieves record data from Gale API."""
# check if an item with this source id + page range exists
- 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 cluster_save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cluster_save(sender, instance, **kwargs):
"""signal handler for cluster save; reindex pages for
associated digitized works"""
# only reindex if cluster id has changed
# and if object has already been saved to the db
- 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"