BjornFJohansson/pydna

View on GitHub
src/pydna/genbankfixer.py

Summary

Maintainability
C
1 day
Test Coverage

File genbankfixer.py has 377 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 pydna distribution and governed by its
# license.  Please see the LICENSE.txt file that should have been included
Severity: Minor
Found in src/pydna/genbankfixer.py - About 5 hrs to fix

    Function toGB has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def toGB(jseq):
        "parses json jseq data and prints out ApE compatible genbank"
    
        # construct the LOCUS header string
        #  LOCUS format:
    Severity: Minor
    Found in src/pydna/genbankfixer.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 toJSON has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def toJSON(gbkstring):
        parsed = multipleGB.parseString(gbkstring)
    
        jseqlist = []
    
    
    Severity: Minor
    Found in src/pydna/genbankfixer.py - About 1 hr 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 wrapstring has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def wrapstring(str_, rowstart, rowend, padfirst=True):
        """
        wraps the provided string in lines of length rowend-rowstart
        and padded on the left by rowstart.
        -> if padfirst is false the first line is not padded
    Severity: Minor
    Found in src/pydna/genbankfixer.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

    Avoid deeply nested control flow statements.
    Open

                        if k in [
                            "ApEinfo_label",
                            "ApEinfo_fwdcolor",
                            "ApEinfo_revcolor",
                            "label",
    Severity: Major
    Found in src/pydna/genbankfixer.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if isinstance(val, str):
                              dct[key] = a[key].strip()
                      nl.append(dct)
      Severity: Major
      Found in src/pydna/genbankfixer.py - About 45 mins to fix

        Function parseGBLoc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def parseGBLoc(s, l_, t):
            """retwingles parsed genbank location strings, assumes no joins of RC and FWD sequences"""
            strand = 1
            locationlist = []
        
        
        Severity: Minor
        Found in src/pydna/genbankfixer.py - About 25 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