BjornFJohansson/pydna

View on GitHub
src/pydna/utils.py

Summary

Maintainability
D
1 day
Test Coverage

File utils.py has 463 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2013-2023 by Björn Johansson.  All rights reserved.
# This code is part of the Python-dna distribution and governed by its
# license.  Please see the LICENSE.txt file that should have been included
Severity: Minor
Found in src/pydna/utils.py - About 7 hrs to fix

    Function eq has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def eq(*args, **kwargs):
        """Compare two or more DNA sequences for equality.
    
        Compares two or more DNA sequences for equality i.e. if they
        represent the same double stranded DNA molecule.
    Severity: Minor
    Found in src/pydna/utils.py - About 5 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 shift_location has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def shift_location(original_location, shift, lim):
        """docstring."""
        newparts = []
        strand = original_location.strand
    
    
    Severity: Minor
    Found in src/pydna/utils.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 memorize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def memorize(filename):
        """Cache functions and classes.
    
        see pydna.download
        """
    Severity: Minor
    Found in src/pydna/utils.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