reimandlab/Visualistion-Framework-for-Genome-Mutations

View on GitHub
website/imports/protein_data.py

Summary

Maintainability
D
2 days
Test Coverage

File protein_data.py has 888 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from collections import defaultdict, namedtuple
from pathlib import Path
from typing import Callable, Type
from warnings import warn

Severity: Major
Found in website/imports/protein_data.py - About 2 days to fix

    Function proteins_and_genes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def proteins_and_genes(path='data/protein_data.tsv'):
        """Create proteins and genes based on data in a given file.
    
        If protein/gene already exists it will be skipped.
    
    
    Severity: Minor
    Found in website/imports/protein_data.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 parser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def parser(line):
            nonlocal previous_level, new_domains, domains_stack
    
            result = expr.match(line)
    
    
    Severity: Minor
    Found in website/imports/protein_data.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 parser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def parser(line):
    
            nonlocal skipped, wrong_length, not_matching_chrom
    
            try:
    Severity: Minor
    Found in website/imports/protein_data.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 parser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def parser(line):
            kinase_name, gene_name = line
            protein = get_preferred_gene_isoform(gene_name)
    
            if not protein:
    Severity: Minor
    Found in website/imports/protein_data.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
    Status