Princeton-CDH/ppa-django

View on GitHub
ppa/archive/management/commands/hathi_import.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function handle has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, *args, **kwargs):
        # disconnect signal handler for on-demand indexing, for efficiency
        # (index in bulk after an update, not one at a time)
        IndexableSignalHandler.disconnect()

Severity: Minor
Found in ppa/archive/management/commands/hathi_import.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 import_digitizedwork has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def import_digitizedwork(self, htid):
        """Import a single work into the database.
        Retrieves bibliographic data from Hathi api. If the record already
        exists in the database, it is only updated if the hathi record
        has changed or if an update is requested by the user.
Severity: Minor
Found in ppa/archive/management/commands/hathi_import.py - About 55 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

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
Severity: Minor
Found in ppa/archive/management/commands/hathi_import.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

There are no issues that match your filters.

Category
Status